From 0e92fd21d0cfa1e7cad265b8e69b2652c0afe58a Mon Sep 17 00:00:00 2001 From: Chris Crone Date: Tue, 4 Aug 2020 16:31:02 +0200 Subject: [PATCH] cli.options: Do not test port list order Signed-off-by: Chris Crone --- cli/options/run/opts_test.go | 5 ++++- go.mod | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/options/run/opts_test.go b/cli/options/run/opts_test.go index 5127662b9..55e5d0402 100644 --- a/cli/options/run/opts_test.go +++ b/cli/options/run/opts_test.go @@ -21,6 +21,7 @@ import ( "regexp" "testing" + "github.com/google/go-cmp/cmp/cmpopts" "gotest.tools/v3/assert" "gotest.tools/v3/assert/cmp" @@ -121,7 +122,9 @@ func TestPortParse(t *testing.T) { } result, err := opts.toPorts() assert.NilError(t, err) - assert.DeepEqual(t, result, testCase.expected) + assert.DeepEqual(t, result, testCase.expected, cmpopts.SortSlices(func(x, y containers.Port) bool { + return x.ContainerPort < y.ContainerPort + })) } } diff --git a/go.mod b/go.mod index d4ff1b295..a4eb82bf4 100644 --- a/go.mod +++ b/go.mod @@ -34,6 +34,7 @@ require ( github.com/gobwas/ws v1.0.3 github.com/gogo/googleapis v1.4.0 // indirect github.com/golang/protobuf v1.4.2 + github.com/google/go-cmp v0.5.0 github.com/google/uuid v1.1.1 github.com/gorilla/mux v1.7.4 // indirect github.com/hashicorp/go-multierror v1.1.0