@@ -1017,6 +1017,81 @@ func TestLoadMultipleNetworks(t *testing.T) {
10171017 }, config )
10181018}
10191019
1020+ func TestLoadMultipleServiceVolumes (t * testing.T ) {
1021+ base := map [string ]interface {}{
1022+ "version" : "3.7" ,
1023+ "services" : map [string ]interface {}{
1024+ "foo" : map [string ]interface {}{
1025+ "image" : "baz" ,
1026+ "volumes" : []interface {}{
1027+ map [string ]interface {}{
1028+ "type" : "volume" ,
1029+ "source" : "sourceVolume" ,
1030+ "target" : "/var/app" ,
1031+ },
1032+ },
1033+ },
1034+ },
1035+ "volumes" : map [string ]interface {}{
1036+ "sourceVolume" : map [string ]interface {}{},
1037+ },
1038+ "networks" : map [string ]interface {}{},
1039+ "secrets" : map [string ]interface {}{},
1040+ "configs" : map [string ]interface {}{},
1041+ }
1042+ override := map [string ]interface {}{
1043+ "version" : "3.7" ,
1044+ "services" : map [string ]interface {}{
1045+ "foo" : map [string ]interface {}{
1046+ "image" : "baz" ,
1047+ "volumes" : []interface {}{
1048+ map [string ]interface {}{
1049+ "type" : "volume" ,
1050+ "source" : "/local" ,
1051+ "target" : "/var/app" ,
1052+ },
1053+ },
1054+ },
1055+ },
1056+ "volumes" : map [string ]interface {}{},
1057+ "networks" : map [string ]interface {}{},
1058+ "secrets" : map [string ]interface {}{},
1059+ "configs" : map [string ]interface {}{},
1060+ }
1061+ configDetails := types.ConfigDetails {
1062+ ConfigFiles : []types.ConfigFile {
1063+ {Filename : "base.yml" , Config : base },
1064+ {Filename : "override.yml" , Config : override },
1065+ },
1066+ }
1067+ config , err := Load (configDetails )
1068+ assert .NilError (t , err )
1069+ assert .DeepEqual (t , & types.Config {
1070+ Filename : "base.yml" ,
1071+ Version : "3.7" ,
1072+ Services : []types.ServiceConfig {
1073+ {
1074+ Name : "foo" ,
1075+ Image : "baz" ,
1076+ Environment : types.MappingWithEquals {},
1077+ Volumes : []types.ServiceVolumeConfig {
1078+ {
1079+ Type : "volume" ,
1080+ Source : "/local" ,
1081+ Target : "/var/app" ,
1082+ },
1083+ },
1084+ },
1085+ },
1086+ Volumes : map [string ]types.VolumeConfig {
1087+ "sourceVolume" : {},
1088+ },
1089+ Secrets : map [string ]types.SecretConfig {},
1090+ Configs : map [string ]types.ConfigObjConfig {},
1091+ Networks : map [string ]types.NetworkConfig {},
1092+ }, config )
1093+ }
1094+
10201095func TestMergeUlimitsConfig (t * testing.T ) {
10211096 specials := & specials {
10221097 m : map [reflect.Type ]func (dst , src reflect.Value ) error {
0 commit comments