things are working now

This commit is contained in:
sharifelgamal
2018-03-20 10:56:19 -07:00
parent 5578e683a1
commit 58ce938778
2 changed files with 6 additions and 3 deletions
+4 -3
View File
@@ -11,7 +11,7 @@ type ExposeCommand struct {
}
func (r *ExposeCommand) ExecuteCommand(config *manifest.Schema2Config) error {
return updateExposedPorts(r.Ports, config)
return updateExposedPorts(r.cmd.Ports, config)
}
func updateExposedPorts(ports []string, config *manifest.Schema2Config) error {
@@ -24,7 +24,8 @@ func updateExposedPorts(ports []string, config *manifest.Schema2Config) error {
if !strings.Contains(p, "/") {
p = p + "/tcp"
}
existingPorts[p] = {}
var x struct{}
existingPorts[manifest.Schema2Port(p)] = x
}
config.ExposedPorts = existingPorts
return nil
@@ -36,5 +37,5 @@ func (r *ExposeCommand) FilesToSnapshot() []string {
func (r *ExposeCommand) CreatedBy() string {
s := []string{"/bin/sh", "-c"}
return strings.Join(append(s, r.Ports...), " ")
return strings.Join(append(s, r.cmd.Ports...), " ")
}
+2
View File
@@ -17,12 +17,14 @@ func TestUpdateExposedPorts(t *testing.T) {
"8080",
"8081/tcp",
"8082",
"8083/udp",
}
expectedPorts := manifest.Schema2PortSet{
"8080/tcp": {},
"8081/tcp": {},
"8082/tcp": {},
"8083/udp": {},
}
updateExposedPorts(ports, cfg)