@@ -26,9 +26,21 @@ import (
2626 "gotest.tools/v3/assert"
2727)
2828
29+ func TestLoadIncludeExtendsCombined (t * testing.T ) {
30+ _ , err := LoadWithContext (context .Background (), types.ConfigDetails {
31+ WorkingDir : "testdata/combined" ,
32+ ConfigFiles : []types.ConfigFile {
33+ {
34+ Filename : "testdata/combined/compose.yaml" ,
35+ },
36+ },
37+ }, withProjectName ("test-load-combined" , true ))
38+ assert .NilError (t , err )
39+ }
40+
2941func TestLoadWithMultipleInclude (t * testing.T ) {
3042 // include same service twice should not trigger an error
31- p , err := Load ( buildConfigDetails (`
43+ details := buildConfigDetails (`
3244name: 'test-multi-include'
3345
3446include:
@@ -41,17 +53,21 @@ services:
4153 image: busybox
4254 depends_on:
4355 - imported
44- ` , map [string ]string {"SOURCE" : "override" }), func (options * Options ) {
56+ ` , map [string ]string {"SOURCE" : "override" })
57+
58+ p , err := Load (details , func (options * Options ) {
4559 options .SkipNormalization = true
4660 options .ResolvePaths = true
4761 })
4862 assert .NilError (t , err )
4963 imported , err := p .GetService ("imported" )
5064 assert .NilError (t , err )
5165 assert .Equal (t , imported .ContainerName , "override" )
66+ }
5267
68+ func TestLoadWithMultipleIncludeConflict (t * testing.T ) {
5369 // include 2 different services with same name should trigger an error
54- _ , err = Load ( buildConfigDetails (`
70+ details := buildConfigDetails (`
5571name: 'test-multi-include'
5672
5773include:
@@ -64,7 +80,8 @@ include:
6480services:
6581 bar:
6682 image: busybox
67- ` , map [string ]string {"SOURCE" : "override" }), func (options * Options ) {
83+ ` , map [string ]string {"SOURCE" : "override" })
84+ _ , err := Load (details , func (options * Options ) {
6885 options .SkipNormalization = true
6986 options .ResolvePaths = true
7087 })
0 commit comments