manifest: test non-default arch
This commit is contained in:
parent
3532dbec44
commit
5cfb31e65b
|
|
@ -22,16 +22,24 @@ func TestParseError(t *testing.T) {
|
||||||
func TestArchFile(t *testing.T) {
|
func TestArchFile(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
file string
|
file string
|
||||||
defaultArchFile string
|
arch string
|
||||||
|
expectedFile string
|
||||||
}{{
|
}{{
|
||||||
file: "",
|
file: "",
|
||||||
defaultArchFile: "Dockerfile",
|
arch: manifest.DefaultArchitecture,
|
||||||
|
expectedFile: "Dockerfile",
|
||||||
}, {
|
}, {
|
||||||
file: "Dockerfile",
|
file: "Dockerfile",
|
||||||
defaultArchFile: "Dockerfile",
|
arch: manifest.DefaultArchitecture,
|
||||||
|
expectedFile: "Dockerfile",
|
||||||
}, {
|
}, {
|
||||||
file: "Dockerfile-foo",
|
file: "Dockerfile-foo",
|
||||||
defaultArchFile: "Dockerfile-foo",
|
arch: manifest.DefaultArchitecture,
|
||||||
|
expectedFile: "Dockerfile-foo",
|
||||||
|
}, {
|
||||||
|
file: "Dockerfile-i386",
|
||||||
|
arch: "i386",
|
||||||
|
expectedFile: "Dockerfile-i386",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,6 +47,9 @@ func TestArchFile(t *testing.T) {
|
||||||
manString := `Maintainers: Giuseppe Valente <gvalente@arista.com> (@7AC)
|
manString := `Maintainers: Giuseppe Valente <gvalente@arista.com> (@7AC)
|
||||||
GitCommit: abcdef
|
GitCommit: abcdef
|
||||||
`
|
`
|
||||||
|
if test.arch != manifest.DefaultArchitecture {
|
||||||
|
manString += test.arch + "-"
|
||||||
|
}
|
||||||
if test.file != "" {
|
if test.file != "" {
|
||||||
manString += "File: " + test.file
|
manString += "File: " + test.file
|
||||||
}
|
}
|
||||||
|
|
@ -46,8 +57,9 @@ GitCommit: abcdef
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected error: %v", err)
|
t.Fatalf("Unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
if man.Global.ArchFile(manifest.DefaultArchitecture) != test.defaultArchFile {
|
actualFile := man.Global.ArchFile(test.arch)
|
||||||
t.Fatalf("Unexpected arch file: %s", man.Global.ArchFile(manifest.DefaultArchitecture))
|
if actualFile != test.expectedFile {
|
||||||
|
t.Fatalf("Unexpected arch file: %s (expected %q)", actualFile, test.expectedFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue