-
Notifications
You must be signed in to change notification settings - Fork 899
fix(agent/agentcontainers): improve testing of convertDockerInspect, return correct host port #16887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(agent/agentcontainers): improve testing of convertDockerInspect, return correct host port #16887
Changes from 1 commit
80ac9a3
0ecceb0
55998d0
fb78d33
a7d1ea4
393f6e9
95b156e
f8f3000
999469f
8338af3
2f0180e
1ae6015
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4273,45 +4273,45 @@ function mockTwoDaysAgo() { | |
return date.toISOString(); | ||
} | ||
|
||
export const MockWorkspaceAgentDevcontainerPorts: TypesGen.WorkspaceAgentDevcontainerPort[] = [ | ||
{ | ||
port: 1000, | ||
network: "tcp", | ||
host_port: 1000, | ||
host_ip: "0.0.0.0" | ||
}, | ||
{ | ||
port: 2001, | ||
network: "tcp", | ||
host_port: 2000, | ||
host_ip: "::1" | ||
}, | ||
export const MockWorkspaceAgentDevcontainerPorts: TypesGen.WorkspaceAgentDevcontainerPort[] = | ||
[ | ||
{ | ||
port: 1000, | ||
network: "tcp", | ||
host_port: 1000, | ||
host_ip: "0.0.0.0", | ||
}, | ||
{ | ||
port: 2001, | ||
network: "tcp", | ||
host_port: 2000, | ||
host_ip: "::1", | ||
}, | ||
{ | ||
port: 8888, | ||
network: "tcp", | ||
}, | ||
Comment on lines
+4290
to
+4293
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just making sure: is it possible for there to be variants of the port value that have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it likely in practice. |
||
]; | ||
|
||
export const MockWorkspaceAgentDevcontainer: TypesGen.WorkspaceAgentDevcontainer = | ||
{ | ||
port: 8888, | ||
network: "tcp", | ||
} | ||
] | ||
|
||
export const MockWorkspaceAgentDevcontainer : TypesGen.WorkspaceAgentDevcontainer = { | ||
created_at: "2024-01-04T15:53:03.21563Z", | ||
id: "abcd1234", | ||
name: "container-1", | ||
image: "ubuntu:latest", | ||
labels: { | ||
"foo": "bar" | ||
}, | ||
ports: [], | ||
running: true, | ||
status: "running", | ||
volumes: { | ||
"/mnt/volume1": "/volume1", | ||
} | ||
} | ||
created_at: "2024-01-04T15:53:03.21563Z", | ||
id: "abcd1234", | ||
name: "container-1", | ||
image: "ubuntu:latest", | ||
labels: { | ||
foo: "bar", | ||
}, | ||
ports: [], | ||
running: true, | ||
status: "running", | ||
volumes: { | ||
"/mnt/volume1": "/volume1", | ||
}, | ||
}; | ||
|
||
export const MockWorkspaceAgentListContainersResponse: TypesGen.WorkspaceAgentListContainersResponse = | ||
{ | ||
containers: [ | ||
MockWorkspaceAgentDevcontainer, | ||
], | ||
"warnings": ["This is a warning"], | ||
} | ||
{ | ||
containers: [MockWorkspaceAgentDevcontainer], | ||
warnings: ["This is a warning"], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm finding this quite strange. Why not only return from the API null or undefined? Having the API returning both types look strange to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this seems like it was meant to be double-bookkeeping, but with how the server types are set up, the
null
conditionals won't ever trigger. TheomitEmpty
JSON tag will make sure that if the values ofhost_ip
orhost_port
are missing, they'll always evaluate toundefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Will remove the extraneous
null
checks.