mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
fix(agent/agentcontainers): improve testing of convertDockerInspect, return correct host port (#16887)
* Improves separation of concerns between `runDockerInspect` and `convertDockerInspect`: `runDockerInspect` now just runs the command and returns the output, while `convertDockerInspect` now does all of the conversion and parsing logic. * Improves testing of `convertDockerInspect` using real test fixtures. * Fixes issue where the container port is returned instead of the host port. * Updates UI to link to correct host port. Container port is still displayed in the button text, but the HostIP:HostPort is shown in a popover. * Adds stories for workspace agent UI
This commit is contained in:
23
coderd/apidoc/docs.go
generated
23
coderd/apidoc/docs.go
generated
@ -16211,7 +16211,7 @@ const docTemplate = `{
|
||||
"description": "Ports includes ports exposed by the container.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAgentListeningPort"
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAgentDevcontainerPort"
|
||||
}
|
||||
},
|
||||
"running": {
|
||||
@ -16231,6 +16231,27 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.WorkspaceAgentDevcontainerPort": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"host_ip": {
|
||||
"description": "HostIP is the IP address of the host interface to which the port is\nbound. Note that this can be an IPv4 or IPv6 address.",
|
||||
"type": "string"
|
||||
},
|
||||
"host_port": {
|
||||
"description": "HostPort is the port number *outside* the container.",
|
||||
"type": "integer"
|
||||
},
|
||||
"network": {
|
||||
"description": "Network is the network protocol used by the port (tcp, udp, etc).",
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"description": "Port is the port number *inside* the container.",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.WorkspaceAgentHealth": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
23
coderd/apidoc/swagger.json
generated
23
coderd/apidoc/swagger.json
generated
@ -14784,7 +14784,7 @@
|
||||
"description": "Ports includes ports exposed by the container.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAgentListeningPort"
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAgentDevcontainerPort"
|
||||
}
|
||||
},
|
||||
"running": {
|
||||
@ -14804,6 +14804,27 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.WorkspaceAgentDevcontainerPort": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"host_ip": {
|
||||
"description": "HostIP is the IP address of the host interface to which the port is\nbound. Note that this can be an IPv4 or IPv6 address.",
|
||||
"type": "string"
|
||||
},
|
||||
"host_port": {
|
||||
"description": "HostPort is the port number *outside* the container.",
|
||||
"type": "integer"
|
||||
},
|
||||
"network": {
|
||||
"description": "Network is the network protocol used by the port (tcp, udp, etc).",
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"description": "Port is the port number *inside* the container.",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.WorkspaceAgentHealth": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -1173,10 +1173,12 @@ func TestWorkspaceAgentContainers(t *testing.T) {
|
||||
Labels: testLabels,
|
||||
Running: true,
|
||||
Status: "running",
|
||||
Ports: []codersdk.WorkspaceAgentListeningPort{
|
||||
Ports: []codersdk.WorkspaceAgentDevcontainerPort{
|
||||
{
|
||||
Network: "tcp",
|
||||
Port: 80,
|
||||
Network: "tcp",
|
||||
Port: 80,
|
||||
HostIP: "0.0.0.0",
|
||||
HostPort: 8000,
|
||||
},
|
||||
},
|
||||
Volumes: map[string]string{
|
||||
|
Reference in New Issue
Block a user