test/image: use basename of test case
This makes it easier to use the test binary with the `-run` argument.
Instead of the full path:
-test.run TestImages//usr/share/tests/osbuild-composer/cases/rhel_8.2-x86_64-openstack-boot.json
this only requires the actual name:
-test.run TestImages/rhel_8.2-x86_64-openstack-boot.json
This commit is contained in:
parent
b3e14a4e68
commit
cd674ea39f
1 changed files with 6 additions and 5 deletions
|
|
@ -13,6 +13,7 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
|
@ -397,16 +398,16 @@ func runTests(t *testing.T, cases []string) {
|
|||
require.NoError(t, err, "error removing temporary store")
|
||||
}()
|
||||
|
||||
for _, path := range cases {
|
||||
t.Run(path, func(t *testing.T) {
|
||||
f, err := os.Open(path)
|
||||
for _, p := range cases {
|
||||
t.Run(path.Base(p), func(t *testing.T) {
|
||||
f, err := os.Open(p)
|
||||
if err != nil {
|
||||
t.Skipf("%s: cannot open test case: %#v", path, err)
|
||||
t.Skipf("%s: cannot open test case: %#v", p, err)
|
||||
}
|
||||
|
||||
var testcase testcaseStruct
|
||||
err = json.NewDecoder(f).Decode(&testcase)
|
||||
require.NoErrorf(t, err, "%s: cannot decode test case: %#v", path, err)
|
||||
require.NoErrorf(t, err, "%s: cannot decode test case", p)
|
||||
|
||||
currentArch := common.CurrentArch()
|
||||
if testcase.ComposeRequest.Arch != currentArch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue