@@ -261,14 +261,8 @@ var sampleConfig = types.Config{
261261 },
262262}
263263
264- func TestParseYAML (t * testing.T ) {
265- dict , err := ParseYAML ([]byte (sampleYAML ))
266- assert .NilError (t , err )
267- assert .Check (t , is .DeepEqual (sampleDict , dict ))
268- }
269-
270264func TestLoad (t * testing.T ) {
271- actual , err := Load ( buildConfigDetails (sampleYAML , nil ), func (options * Options ) {
265+ actual , err := LoadWithContext ( context . TODO (), buildConfigDetails (sampleYAML , nil ), func (options * Options ) {
272266 options .SkipNormalization = true
273267 options .SkipConsistencyCheck = true
274268 })
@@ -288,7 +282,7 @@ func TestLoadFromFile(t *testing.T) {
288282 if err := os .WriteFile (tmpPath , []byte (sampleYAML ), 0o444 ); err != nil {
289283 t .Fatalf ("failed to write temporary file: %s" , err )
290284 }
291- actual , err := Load ( types.ConfigDetails {
285+ actual , err := LoadWithContext ( context . TODO (), types.ConfigDetails {
292286 WorkingDir : workingDir ,
293287 ConfigFiles : []types.ConfigFile {{
294288 Filename : tmpPath ,
@@ -431,7 +425,7 @@ services:
431425`
432426 assert .NilError (t , os .WriteFile (filepath .Join (tmpdir , "compose.yaml" ), []byte (rootYAML ), 0o600 ))
433427
434- actual , err := Load ( types.ConfigDetails {
428+ actual , err := LoadWithContext ( context . TODO (), types.ConfigDetails {
435429 WorkingDir : tmpdir ,
436430 ConfigFiles : []types.ConfigFile {{
437431 Filename : filepath .Join (tmpdir , "compose.yaml" ),
@@ -813,7 +807,7 @@ networks:
813807 "thesize" : "2gb" ,
814808 }
815809
816- config , err := Load ( buildConfigDetails (dict , env ), func (options * Options ) {
810+ config , err := LoadWithContext ( context . TODO (), buildConfigDetails (dict , env ), func (options * Options ) {
817811 options .SkipNormalization = true
818812 options .SkipConsistencyCheck = true
819813 })
@@ -982,7 +976,7 @@ services:
982976`
983977 configDetails := buildConfigDetails (dict , nil )
984978
985- _ , err := Load ( configDetails )
979+ _ , err := LoadWithContext ( context . TODO (), configDetails )
986980 assert .NilError (t , err )
987981}
988982
@@ -1007,7 +1001,7 @@ services:
10071001 configDetails := buildConfigDetails (dict , nil )
10081002
10091003 // Default behavior keeps the `env_file` entries
1010- configWithEnvFiles , err := Load ( configDetails , func (options * Options ) {
1004+ configWithEnvFiles , err := LoadWithContext ( context . TODO (), configDetails , func (options * Options ) {
10111005 options .SkipNormalization = true
10121006 options .ResolvePaths = false
10131007 })
@@ -1024,7 +1018,7 @@ services:
10241018 assert .DeepEqual (t , configWithEnvFiles .Services ["web" ].Environment , expectedEnvironmentMap )
10251019
10261020 // Custom behavior removes the `env_file` entries
1027- configWithoutEnvFiles , err := Load ( configDetails , WithDiscardEnvFiles )
1021+ configWithoutEnvFiles , err := LoadWithContext ( context . TODO (), configDetails , WithDiscardEnvFiles )
10281022 assert .NilError (t , err )
10291023 assert .Equal (t , len (configWithoutEnvFiles .Services ["web" ].EnvFiles ), 0 )
10301024 assert .DeepEqual (t , configWithoutEnvFiles .Services ["web" ].Environment , expectedEnvironmentMap )
@@ -1034,7 +1028,7 @@ func TestDecodeErrors(t *testing.T) {
10341028 dict := "name: test\n services:\n web:\n image: nginx\n \t build: ."
10351029
10361030 configDetails := buildConfigDetails (dict , nil )
1037- _ , err := Load ( configDetails )
1031+ _ , err := LoadWithContext ( context . TODO (), configDetails )
10381032 assert .Error (t , err , "yaml: line 4: found a tab character that violates indentation" )
10391033}
10401034
@@ -1054,7 +1048,7 @@ services:
10541048 shm_size: 2gb
10551049`
10561050 configDetails := buildConfigDetails (dict , nil )
1057- actual , err := Load ( configDetails )
1051+ actual , err := LoadWithContext ( context . TODO (), configDetails )
10581052 assert .NilError (t , err )
10591053
10601054 wd , _ := os .Getwd ()
@@ -1084,7 +1078,7 @@ services:
10841078`
10851079 configDetails := buildConfigDetails (dict , nil )
10861080
1087- _ , err := Load ( configDetails )
1081+ _ , err := LoadWithContext ( context . TODO (), configDetails )
10881082 assert .NilError (t , err )
10891083}
10901084
@@ -2145,7 +2139,7 @@ func TestLoadWithExtends(t *testing.T) {
21452139 Environment : map [string ]string {},
21462140 }
21472141
2148- actual , err := Load ( configDetails )
2142+ actual , err := LoadWithContext ( context . TODO (), configDetails )
21492143 assert .NilError (t , err )
21502144
21512145 extendsDir := filepath .Join ("testdata" , "subdir" )
@@ -2189,7 +2183,7 @@ func TestLoadWithExtendsWithContextUrl(t *testing.T) {
21892183 Environment : map [string ]string {},
21902184 }
21912185
2192- actual , err := Load ( configDetails )
2186+ actual , err := LoadWithContext ( context . TODO (), configDetails )
21932187 assert .NilError (t , err )
21942188
21952189 expServices := types.Services {
@@ -2568,7 +2562,7 @@ services:
25682562`
25692563 configDetails := buildConfigDetails (yaml , map [string ]string {})
25702564
2571- actual , err := Load ( configDetails )
2565+ actual , err := LoadWithContext ( context . TODO (), configDetails )
25722566 assert .NilError (t , err )
25732567 svc , err := actual .GetService ("web" )
25742568 assert .NilError (t , err )
@@ -2598,7 +2592,7 @@ services:
25982592`
25992593 configDetails := buildConfigDetailsMultipleFiles (map [string ]string {}, yaml1 , yaml2 , yaml3 )
26002594
2601- actual , err := Load ( configDetails )
2595+ actual , err := LoadWithContext ( context . TODO (), configDetails )
26022596 assert .NilError (t , err )
26032597 svc , err := actual .GetService ("web" )
26042598 assert .NilError (t , err )
@@ -2623,7 +2617,7 @@ services:
26232617`
26242618 configDetails := buildConfigDetails (yaml , map [string ]string {})
26252619
2626- actual , err := Load ( configDetails , withProjectName ("interpolated" , true ))
2620+ actual , err := LoadWithContext ( context . TODO (), configDetails , withProjectName ("interpolated" , true ))
26272621 assert .NilError (t , err )
26282622 svc , err := actual .GetService ("web" )
26292623 assert .NilError (t , err )
@@ -2649,7 +2643,7 @@ volumes:
26492643`
26502644 configDetails := buildConfigDetails (dict , nil )
26512645
2652- project , err := Load ( configDetails )
2646+ project , err := LoadWithContext ( context . TODO (), configDetails )
26532647 assert .NilError (t , err )
26542648 path := project .Volumes ["data" ].DriverOpts ["device" ]
26552649 assert .Check (t , filepath .IsAbs (path ))
@@ -2665,7 +2659,7 @@ services:
26652659`
26662660 configDetails := buildConfigDetails (dict , nil )
26672661
2668- project , err := Load ( configDetails )
2662+ project , err := LoadWithContext ( context . TODO (), configDetails )
26692663 assert .NilError (t , err )
26702664 assert .Equal (t , project .Services ["extension" ].Name , "extension" )
26712665 assert .Equal (t , project .Services ["extension" ].Extensions ["x-foo" ], "bar" )
@@ -2782,7 +2776,7 @@ configs:
27822776func TestLoadWithInclude (t * testing.T ) {
27832777 workingDir , err := os .Getwd ()
27842778 assert .NilError (t , err )
2785- p , err := Load ( buildConfigDetails (`
2779+ p , err := LoadWithContext ( context . TODO (), buildConfigDetails (`
27862780name: 'test-include'
27872781
27882782include:
@@ -2839,7 +2833,7 @@ services:
28392833 })
28402834 */
28412835
2842- p , err = Load ( buildConfigDetails (`
2836+ p , err = LoadWithContext ( context . TODO (), buildConfigDetails (`
28432837name: 'test-include'
28442838
28452839include:
@@ -2864,7 +2858,7 @@ services:
28642858func TestLoadWithIncludeCycle (t * testing.T ) {
28652859 workingDir , err := os .Getwd ()
28662860 assert .NilError (t , err )
2867- _ , err = Load ( types.ConfigDetails {
2861+ _ , err = LoadWithContext ( context . TODO (), types.ConfigDetails {
28682862 WorkingDir : filepath .Join (workingDir , "testdata" ),
28692863 ConfigFiles : []types.ConfigFile {
28702864 {
@@ -2876,7 +2870,7 @@ func TestLoadWithIncludeCycle(t *testing.T) {
28762870}
28772871
28782872func TestLoadWithIncludeOverride (t * testing.T ) {
2879- p , err := Load ( buildConfigDetailsMultipleFiles (nil , `
2873+ p , err := LoadWithContext ( context . TODO (), buildConfigDetailsMultipleFiles (nil , `
28802874name: 'test-include-override'
28812875
28822876include:
@@ -3097,7 +3091,7 @@ services:
30973091}
30983092
30993093func TestLoadDevelopConfig (t * testing.T ) {
3100- project , err := Load ( buildConfigDetails (`
3094+ project , err := LoadWithContext ( context . TODO (), buildConfigDetails (`
31013095name: load-develop
31023096services:
31033097 frontend:
@@ -3225,7 +3219,7 @@ services:
32253219 if err := os .WriteFile (tmpPath , []byte (yaml ), 0o644 ); err != nil {
32263220 t .Fatalf ("failed to write temporary file: %s" , err )
32273221 }
3228- _ , err := Load ( types.ConfigDetails {
3222+ _ , err := LoadWithContext ( context . TODO (), types.ConfigDetails {
32293223 ConfigFiles : []types.ConfigFile {
32303224 {
32313225 Filename : tmpPath ,
@@ -3246,7 +3240,7 @@ services:
32463240 if err := os .WriteFile (tmpPath , []byte (yaml ), 0o644 ); err != nil {
32473241 t .Fatalf ("failed to write temporary file: %s" , err )
32483242 }
3249- _ , err := Load ( types.ConfigDetails {
3243+ _ , err := LoadWithContext ( context . TODO (), types.ConfigDetails {
32503244 ConfigFiles : []types.ConfigFile {
32513245 {
32523246 Filename : tmpPath ,
0 commit comments