@@ -92,17 +92,25 @@ func TestStepCreateCD(t *testing.T) {
9292 }
9393 defer os .RemoveAll (dir )
9494
95- expected := map [string ]string {
95+ createFiles ( t , dir , map [string ]string {
9696 "test folder/b/test1" : "1" ,
9797 "test folder/b/test2" : "2" ,
9898 "test folder 2/x" : "3" ,
9999 "test_cd_roms.tmp" : "4" ,
100100 "test cd files.tmp" : "5" ,
101101 "Test-Test-Test5.tmp" : "6" ,
102+ "subfolder/meta-data" : "subfolder/meta-data from files" ,
103+ "subfolder/user-data" : "subfolder/user-data from files" ,
104+ "user-data" : "user-data from files" ,
105+ "vendor-data" : "vendor-data from files" ,
106+ })
107+ step .Content = map [string ]string {
108+ "subfolder not created by files/test.tmp" : "test" ,
109+ "subfolder/meta-data" : "subfolder/meta-data from content" ,
110+ "user-data" : "user-data from content" ,
102111 }
103112
104- createFiles (t , dir , expected )
105- files := []string {"test folder" , "test folder 2/" , "test_cd_roms.tmp" , "test cd files.tmp" , "Test-Test-Test5.tmp" }
113+ files := []string {"test folder" , "test folder 2/" , "test_cd_roms.tmp" , "test cd files.tmp" , "Test-Test-Test5.tmp" , "subfolder" , "user-data" , "vendor-data" }
106114
107115 step .Files = make ([]string , len (files ))
108116 for i , fname := range files {
@@ -124,7 +132,19 @@ func TestStepCreateCD(t *testing.T) {
124132 t .Fatalf ("file not found: %s for %v" , CD_path , step .Files )
125133 }
126134
127- checkFiles (t , step .rootFolder , expected )
135+ checkFiles (t , step .rootFolder , map [string ]string {
136+ "test folder/b/test1" : "1" ,
137+ "test folder/b/test2" : "2" ,
138+ "test folder 2/x" : "3" ,
139+ "test_cd_roms.tmp" : "4" ,
140+ "test cd files.tmp" : "5" ,
141+ "Test-Test-Test5.tmp" : "6" ,
142+ "subfolder not created by files/test.tmp" : "test" ,
143+ "subfolder/meta-data" : "subfolder/meta-data from content" ,
144+ "subfolder/user-data" : "subfolder/user-data from files" ,
145+ "user-data" : "user-data from content" ,
146+ "vendor-data" : "vendor-data from files" ,
147+ })
128148
129149 step .Cleanup (state )
130150
@@ -150,6 +170,9 @@ func TestStepCreateCD_missing(t *testing.T) {
150170 defer os .RemoveAll (dir )
151171
152172 step .Files = []string {"missing file.tmp" }
173+ step .Content = map [string ]string {
174+ "test_cd_roms.tmp" : "should not be created" ,
175+ }
153176 if action := step .Run (context .Background (), state ); action != multistep .ActionHalt {
154177 t .Fatalf ("bad action: %#v for %v" , action , step .Files )
155178 }
0 commit comments