Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Adjusted the test and fixed port mapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skarlso committed Mar 31, 2019
1 parent d183e61 commit 9ca9c4b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
5 changes: 5 additions & 0 deletions pkg/cluster/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ func (JSONFormatter) Format(machines []*Machine) error {
}
ports = append(ports, p)
}
if len(ports) < 1 {
for _, p := range m.spec.PortMappings {
ports = append(ports, port{Host:int(p.ContainerPort), Guest:0})
}
}
s.Ports = ports
statuses = append(statuses, s)
}
Expand Down
26 changes: 12 additions & 14 deletions tests/test-show-ubuntu18.04.golden.output
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
NAME HOSTNAME PORTS IMAGE CMD VOLUMES STATE
NAME HOSTNAME PORTS IMAGE CMD STATE

test-show-ubuntu18.04-node0 node0 22->0 quay.io/footloose/ubuntu18.04 Stopped
test-show-ubuntu18.04-node0 node0 22->0 quay.io/footloose/ubuntu18.04 Stopped
{
"machines": [
{
"name": "test-show-ubuntu18.04-node0",
"spec": {
"name": "node%d",
"image": "quay.io/footloose/ubuntu18.04",
"portMappings": [
{
"containerPort": 22
}
]
},
"status": "Stopped",
"ports": null,
"hostname": "node0"
"state": "Stopped",
"ports": [
{
"guest": 0,
"host": 22
}
],
"hostname": "node0",
"image": "quay.io/footloose/ubuntu18.04",
"cmd": ""
}
]
}

0 comments on commit 9ca9c4b

Please sign in to comment.