Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit ebf0410

Browse files
Merge pull request #2261 from zappy-shu/19.03_backport_2250-reverse-port-long-format-order
[19.03 backport] Reverse order of long-form ports Upstream-commit: e6e0fa0c8f9e2caa51a53405640ae22c3c066cd4 Component: cli
2 parents 3a9fa3f + aeec1f7 commit ebf0410

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

components/cli/cli/command/container/opts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ func parsePortOpts(publishOpts []string) ([]string, error) {
799799

800800
params[opt[0]] = opt[1]
801801
}
802-
optsList = append(optsList, fmt.Sprintf("%s:%s/%s", params["target"], params["published"], params["protocol"]))
802+
optsList = append(optsList, fmt.Sprintf("%s:%s/%s", params["published"], params["target"], params["protocol"]))
803803
}
804804
return optsList, nil
805805
}

components/cli/cli/command/container/opts_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,3 +854,9 @@ func TestParseSystemPaths(t *testing.T) {
854854
assert.DeepEqual(t, readonlyPaths, tc.readonly)
855855
}
856856
}
857+
858+
func TestParsePortOpts(t *testing.T) {
859+
parsed, err := parsePortOpts([]string{"published=1500,target=200", "target=80,published=90"})
860+
assert.NilError(t, err)
861+
assert.DeepEqual(t, []string{"1500:200/tcp", "90:80/tcp"}, parsed)
862+
}

0 commit comments

Comments
 (0)