image-tests: skip tests if the test case cannot be opened

Schutzbot currently runs all the same tests an all arches/distro
combinations. This will not work as we introduce image types only on
some distro/arches.

In the future we should make the image-test binary more clever, so
Schutzbot won't have to tell it which cases to run at all. For now,
simply don't fail if the specified test-case does not exist.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-06-07 22:52:12 +02:00
parent b8f4b9eae9
commit 31f7bd9e74

View file

@ -399,7 +399,9 @@ func runTests(t *testing.T, cases []string) {
for _, path := range cases {
t.Run(path, func(t *testing.T) {
f, err := os.Open(path)
require.NoErrorf(t, err, "%s: cannot open test case: %#v", path, err)
if err != nil {
t.Skipf("%s: cannot open test case: %#v", path, err)
}
var testcase testcaseStruct
err = json.NewDecoder(f).Decode(&testcase)