@@ -27,8 +27,8 @@ import (
2727
2828 "github.com/compose-spec/compose-go/v2/types"
2929 "github.com/docker/cli/cli/streams"
30- "github.com/stretchr/testify/require"
3130 "go.uber.org/mock/gomock"
31+ "gotest.tools/v3/assert"
3232
3333 "github.com/docker/compose/v5/pkg/mocks"
3434)
@@ -56,15 +56,14 @@ func TestApplyPlatforms_InferFromRuntime(t *testing.T) {
5656
5757 t .Run ("SinglePlatform" , func (t * testing.T ) {
5858 project := makeProject ()
59- require . NoError (t , applyPlatforms (project , true ))
60- require . EqualValues (t , [] string {"alice/32" }, project .Services ["test" ].Build .Platforms )
59+ assert . NilError (t , applyPlatforms (project , true ))
60+ assert . DeepEqual (t , types. StringList {"alice/32" }, project .Services ["test" ].Build .Platforms )
6161 })
6262
6363 t .Run ("MultiPlatform" , func (t * testing.T ) {
6464 project := makeProject ()
65- require .NoError (t , applyPlatforms (project , false ))
66- require .EqualValues (t , []string {"linux/amd64" , "linux/arm64" , "alice/32" },
67- project .Services ["test" ].Build .Platforms )
65+ assert .NilError (t , applyPlatforms (project , false ))
66+ assert .DeepEqual (t , types.StringList {"linux/amd64" , "linux/arm64" , "alice/32" }, project .Services ["test" ].Build .Platforms )
6867 })
6968}
7069
@@ -92,15 +91,14 @@ func TestApplyPlatforms_DockerDefaultPlatform(t *testing.T) {
9291
9392 t .Run ("SinglePlatform" , func (t * testing.T ) {
9493 project := makeProject ()
95- require . NoError (t , applyPlatforms (project , true ))
96- require . EqualValues (t , [] string {"linux/amd64" }, project .Services ["test" ].Build .Platforms )
94+ assert . NilError (t , applyPlatforms (project , true ))
95+ assert . DeepEqual (t , types. StringList {"linux/amd64" }, project .Services ["test" ].Build .Platforms )
9796 })
9897
9998 t .Run ("MultiPlatform" , func (t * testing.T ) {
10099 project := makeProject ()
101- require .NoError (t , applyPlatforms (project , false ))
102- require .EqualValues (t , []string {"linux/amd64" , "linux/arm64" },
103- project .Services ["test" ].Build .Platforms )
100+ assert .NilError (t , applyPlatforms (project , false ))
101+ assert .DeepEqual (t , types.StringList {"linux/amd64" , "linux/arm64" }, project .Services ["test" ].Build .Platforms )
104102 })
105103}
106104
@@ -128,13 +126,13 @@ func TestApplyPlatforms_UnsupportedPlatform(t *testing.T) {
128126
129127 t .Run ("SinglePlatform" , func (t * testing.T ) {
130128 project := makeProject ()
131- require . EqualError (t , applyPlatforms (project , true ),
129+ assert . Error (t , applyPlatforms (project , true ),
132130 `service "test" build.platforms does not support value set by DOCKER_DEFAULT_PLATFORM: commodore/64` )
133131 })
134132
135133 t .Run ("MultiPlatform" , func (t * testing.T ) {
136134 project := makeProject ()
137- require . EqualError (t , applyPlatforms (project , false ),
135+ assert . Error (t , applyPlatforms (project , false ),
138136 `service "test" build.platforms does not support value set by DOCKER_DEFAULT_PLATFORM: commodore/64` )
139137 })
140138}
@@ -179,7 +177,7 @@ func TestIsRemoteConfig(t *testing.T) {
179177 },
180178 }
181179 got := isRemoteConfig (cli , opts )
182- require .Equal (t , tt .want , got )
180+ assert .Equal (t , tt .want , got )
183181 })
184182 }
185183}
@@ -206,7 +204,7 @@ func TestDisplayLocationRemoteStack(t *testing.T) {
206204 displayLocationRemoteStack (cli , project , options )
207205
208206 output := buf .String ()
209- require .Equal (t , output , fmt .Sprintf ("Your compose stack %q is stored in %q\n " , "oci://registry.example.com/stack:latest" , "/tmp/test" ))
207+ assert .Equal (t , output , fmt .Sprintf ("Your compose stack %q is stored in %q\n " , "oci://registry.example.com/stack:latest" , "/tmp/test" ))
210208}
211209
212210func TestDisplayInterpolationVariables (t * testing.T ) {
@@ -227,7 +225,7 @@ services:
227225 - UNSET_VAR # optional without default
228226`
229227 composePath := filepath .Join (tmpDir , "docker-compose.yml" )
230- require . NoError (t , os .WriteFile (composePath , []byte (composeContent ), 0o644 ))
228+ assert . NilError (t , os .WriteFile (composePath , []byte (composeContent ), 0o644 ))
231229
232230 buf := new (bytes.Buffer )
233231 cli := mocks .NewMockCli (ctrl )
@@ -244,8 +242,8 @@ services:
244242
245243 // Extract variables from the model
246244 info , noVariables , err := extractInterpolationVariablesFromModel (t .Context (), cli , projectOptions , []string {})
247- require . NoError (t , err )
248- require . False (t , noVariables )
245+ assert . NilError (t , err )
246+ assert . Assert (t , noVariables == false )
249247
250248 // Display the variables
251249 displayInterpolationVariables (cli .Out (), info )
@@ -267,7 +265,7 @@ services:
267265 actualOutput := buf .String ()
268266
269267 // Compare normalized strings
270- require .Equal (t ,
268+ assert .Equal (t ,
271269 normalizeSpaces (expected ),
272270 normalizeSpaces (actualOutput ),
273271 "\n Expected:\n %s\n Got:\n %s" , expected , actualOutput )
@@ -370,14 +368,13 @@ func TestConfirmRemoteIncludes(t *testing.T) {
370368 err := confirmRemoteIncludes (cli , tt .opts , tt .assumeYes )
371369
372370 if tt .wantErr {
373- require .Error (t , err )
374- require .Equal (t , tt .errMessage , err .Error ())
371+ assert .Error (t , err , tt .errMessage )
375372 } else {
376- require . NoError (t , err )
373+ assert . NilError (t , err )
377374 }
378375
379376 if tt .wantOutput != "" {
380- require .Equal (t , tt .wantOutput , buf .String ())
377+ assert .Equal (t , tt .wantOutput , buf .String ())
381378 }
382379 buf .Reset ()
383380 })
0 commit comments