@@ -21,33 +21,45 @@ func TestParseError(t *testing.T) {
2121
2222func TestArchFile (t * testing.T ) {
2323 tests := []struct {
24- file string
25- defaultArchFile string
24+ file string
25+ arch string
26+ expectedFile string
2627 }{{
27- file : "" ,
28- defaultArchFile : "Dockerfile" ,
28+ file : "" ,
29+ arch : manifest .DefaultArchitecture ,
30+ expectedFile : "Dockerfile" ,
2931 }, {
30- file : "Dockerfile" ,
31- defaultArchFile : "Dockerfile" ,
32+ file : "Dockerfile" ,
33+ arch : manifest .DefaultArchitecture ,
34+ expectedFile : "Dockerfile" ,
3235 }, {
33- file : "Dockerfile-foo" ,
34- defaultArchFile : "Dockerfile-foo" ,
36+ file : "Dockerfile-foo" ,
37+ arch : manifest .DefaultArchitecture ,
38+ expectedFile : "Dockerfile-foo" ,
39+ }, {
40+ file : "Dockerfile-i386" ,
41+ arch : "i386" ,
42+ expectedFile : "Dockerfile-i386" ,
3543 },
3644 }
3745
3846 for _ , test := range tests {
3947 manString := `Maintainers: Giuseppe Valente <gvalente@arista.com> (@7AC)
4048GitCommit: abcdef
4149`
50+ if test .arch != manifest .DefaultArchitecture {
51+ manString += test .arch + "-"
52+ }
4253 if test .file != "" {
4354 manString += "File: " + test .file
4455 }
4556 man , err := manifest .Parse2822 (strings .NewReader (manString ))
4657 if err != nil {
4758 t .Fatalf ("Unexpected error: %v" , err )
4859 }
49- if man .Global .ArchFile (manifest .DefaultArchitecture ) != test .defaultArchFile {
50- t .Fatalf ("Unexpected arch file: %s" , man .Global .ArchFile (manifest .DefaultArchitecture ))
60+ actualFile := man .Global .ArchFile (test .arch )
61+ if actualFile != test .expectedFile {
62+ t .Fatalf ("Unexpected arch file: %s (expected %q)" , actualFile , test .expectedFile )
5163 }
5264 }
5365}
0 commit comments