@@ -915,6 +915,55 @@ networks:
915915 assertEqual (t , expected , config )
916916}
917917
918+ func TestLoadWithLabelFile (t * testing.T ) {
919+ workingDir , err := os .Getwd ()
920+ assert .NilError (t , err )
921+ config , err := loadYAML (`
922+ name: load-label-file
923+ services:
924+ service_1:
925+ label_file: ./example1.label
926+ service_2:
927+ label_file:
928+ - ./example2.label
929+ ` )
930+ assert .NilError (t , err )
931+
932+ expected := & types.Project {
933+ Name : "load-label-file" ,
934+ Environment : types.Mapping {"COMPOSE_PROJECT_NAME" : "load-label-file" },
935+ WorkingDir : workingDir ,
936+ Services : types.Services {
937+ "service_1" : {
938+ Name : "service_1" ,
939+ Environment : types.MappingWithEquals {},
940+ Labels : types.Labels {
941+ "BAR" : "bar_from_label_file" ,
942+ "BAZ" : "baz_from_label_file" ,
943+ "FOO" : "foo_from_label_file" ,
944+ "LABEL.WITH.DOT" : "ok" ,
945+ "LABEL_WITH_UNDERSCORE" : "ok" ,
946+ },
947+ LabelFiles : []string {
948+ filepath .Join (workingDir , "example1.label" ),
949+ },
950+ },
951+ "service_2" : {
952+ Name : "service_2" ,
953+ Environment : types.MappingWithEquals {},
954+ Labels : types.Labels {
955+ "BAR" : "bar_from_label_file_2" ,
956+ "QUX" : "quz_from_label_file_2" ,
957+ },
958+ LabelFiles : []string {
959+ filepath .Join (workingDir , "example2.label" ),
960+ },
961+ },
962+ },
963+ }
964+ assertEqual (t , config , expected )
965+ }
966+
918967func TestUnsupportedProperties (t * testing.T ) {
919968 dict := `
920969name: test
0 commit comments