Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c3f11ac

Browse files
committed
cleanup test
1 parent 28bf9a4 commit c3f11ac

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

agent/agentcontainers/devcontainercli_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"strings"
1414
"testing"
1515

16+
"github.com/google/go-cmp/cmp"
1617
"github.com/ory/dockertest/v3"
1718
"github.com/ory/dockertest/v3/docker"
1819
"github.com/stretchr/testify/assert"
@@ -681,10 +682,10 @@ func TestDevcontainerFeatures_OptionsAsEnvs(t *testing.T) {
681682
},
682683
},
683684
want: []string{
684-
"FEATURE_CODE_SERVER_PORT=9090",
685685
"FEATURE_CODE_SERVER_PASSWORD=secret",
686-
"FEATURE_DOCKER_IN_DOCKER_MOBY=false",
686+
"FEATURE_CODE_SERVER_PORT=9090",
687687
"FEATURE_DOCKER_IN_DOCKER_DOCKER_DASH_COMPOSE_VERSION=v2",
688+
"FEATURE_DOCKER_IN_DOCKER_MOBY=false",
688689
},
689690
},
690691
{
@@ -717,7 +718,7 @@ func TestDevcontainerFeatures_OptionsAsEnvs(t *testing.T) {
717718
{
718719
name: "empty features",
719720
features: agentcontainers.DevcontainerFeatures{},
720-
want: []string{},
721+
want: nil,
721722
},
722723
}
723724

@@ -726,11 +727,8 @@ func TestDevcontainerFeatures_OptionsAsEnvs(t *testing.T) {
726727
t.Parallel()
727728

728729
got := tt.features.OptionsAsEnvs()
729-
730-
require.Len(t, got, len(tt.want), "number of environment variables should match")
731-
732-
for _, expected := range tt.want {
733-
assert.Contains(t, got, expected, "expected environment variable not found")
730+
if diff := cmp.Diff(tt.want, got); diff != "" {
731+
require.Failf(t, "OptionsAsEnvs() mismatch (-want +got):\n%s", diff)
734732
}
735733
})
736734
}

0 commit comments

Comments
 (0)