Adjust test to instead use the same example manifest for consistency

This commit is contained in:
Tianon Gravi 2018-07-25 14:30:21 -07:00
parent 5cfb31e65b
commit 49776e367d
2 changed files with 17 additions and 45 deletions

View File

@ -54,10 +54,18 @@ s390x-GitCommit: b6c460e7cd79b595267870a98013ec3078b490df
i386-GitFetch: refs/heads/i386
ppc64le-Directory: 1.5/ppc64le
Tags: 1.5-alpine
GitCommit: d7e2a8d90a9b8f5dfd5bcd428e0c33b68c40cc19
Directory: 1.5
File: Dockerfile.alpine
s390x-File: Dockerfile.alpine.s390x.bad-boy
SharedTags: raspbian
GitCommit: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
Tags: raspbian-s390x
Architectures: s390x, i386
File: Dockerfile-raspbian
s390x-File: Dockerfile
`)))
@ -113,15 +121,24 @@ i: g@h j
// ppc64le-Directory: 1.5/ppc64le
// s390x-GitCommit: b6c460e7cd79b595267870a98013ec3078b490df
//
// Tags: 1.5-alpine
// GitCommit: d7e2a8d90a9b8f5dfd5bcd428e0c33b68c40cc19
// Directory: 1.5
// File: Dockerfile.alpine
// s390x-File: Dockerfile.alpine.s390x.bad-boy
//
// Tags: raspbian-s390x
// SharedTags: raspbian
// Architectures: i386, s390x
// GitCommit: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
// File: Dockerfile-raspbian
// s390x-File: Dockerfile
//
// Shared Tag Groups:
//
// - latest
// - 1.6.1, 1.6, 1
// - 1.5-alpine
//
// - 1.5.3-debian, 1.5-debian
// - 1.5.3, 1.5

View File

@ -18,48 +18,3 @@ func TestParseError(t *testing.T) {
t.Errorf("Unexpected error: %v", err)
}
}
func TestArchFile(t *testing.T) {
tests := []struct {
file string
arch string
expectedFile string
}{{
file: "",
arch: manifest.DefaultArchitecture,
expectedFile: "Dockerfile",
}, {
file: "Dockerfile",
arch: manifest.DefaultArchitecture,
expectedFile: "Dockerfile",
}, {
file: "Dockerfile-foo",
arch: manifest.DefaultArchitecture,
expectedFile: "Dockerfile-foo",
}, {
file: "Dockerfile-i386",
arch: "i386",
expectedFile: "Dockerfile-i386",
},
}
for _, test := range tests {
manString := `Maintainers: Giuseppe Valente <gvalente@arista.com> (@7AC)
GitCommit: abcdef
`
if test.arch != manifest.DefaultArchitecture {
manString += test.arch + "-"
}
if test.file != "" {
manString += "File: " + test.file
}
man, err := manifest.Parse2822(strings.NewReader(manString))
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
actualFile := man.Global.ArchFile(test.arch)
if actualFile != test.expectedFile {
t.Fatalf("Unexpected arch file: %s (expected %q)", actualFile, test.expectedFile)
}
}
}