tests/image: remove all distro restrictions
The distro argument and restrictions to run only tests for the same distro as the host's one were confusing. This commit removes them. Now the behaviour is following: By default all the test cases in test case directory are run. If test cases are given by arguments, they are all run, and test case directory is ignored.
This commit is contained in:
parent
832fb44eb8
commit
1b49755a7e
2 changed files with 7 additions and 23 deletions
10
.travis.yml
10
.travis.yml
|
|
@ -10,13 +10,13 @@ addons:
|
|||
- systemd-container
|
||||
matrix:
|
||||
include:
|
||||
- name: fedora-30
|
||||
- name: f30
|
||||
arch: amd64
|
||||
- name: fedora-30
|
||||
- name: f30
|
||||
arch: arm64
|
||||
- name: fedora-31
|
||||
- name: f31
|
||||
arch: amd64
|
||||
- name: fedora-31
|
||||
- name: f31
|
||||
arch: arm64
|
||||
|
||||
language: generic
|
||||
|
|
@ -26,4 +26,4 @@ script:
|
|||
# ubuntu's rpm package sets dbpath to ~/.rpmdb, which makes rpm fail...
|
||||
- sudo sh -c 'mkdir /etc/rpm; echo "%_dbpath /var/lib/rpm" > /etc/rpm/macros'
|
||||
- go test -c -tags travis,integration -o osbuild-image-tests ./cmd/osbuild-image-tests
|
||||
- sudo ./osbuild-image-tests -test.v --distro $TRAVIS_JOB_NAME
|
||||
- sudo ./osbuild-image-tests -test.v test/cases/$TRAVIS_JOB_NAME*
|
||||
|
|
|
|||
|
|
@ -22,11 +22,8 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
)
|
||||
|
||||
var distroArg = flag.String("distro", "", "which distro tests to run")
|
||||
|
||||
type testcaseStruct struct {
|
||||
ComposeRequest struct {
|
||||
Distro string
|
||||
|
|
@ -296,7 +293,7 @@ func getAllCases() ([]string, error) {
|
|||
}
|
||||
|
||||
// runTests opens, parses and runs all the specified testcases
|
||||
func runTests(t *testing.T, cases []string, d string) {
|
||||
func runTests(t *testing.T, cases []string) {
|
||||
for _, path := range cases {
|
||||
t.Run(path, func(t *testing.T) {
|
||||
f, err := os.Open(path)
|
||||
|
|
@ -311,19 +308,6 @@ func runTests(t *testing.T, cases []string, d string) {
|
|||
t.Skipf("the required arch is %s, the current arch is %s", testcase.ComposeRequest.Arch, currentArch)
|
||||
}
|
||||
|
||||
if d != "" {
|
||||
if testcase.ComposeRequest.Distro != d {
|
||||
t.Skipf("the required distro is %s, the passed distro is %s", testcase.ComposeRequest.Distro, d)
|
||||
}
|
||||
} else {
|
||||
hostDistroName, err := distro.GetHostDistroName()
|
||||
require.Nil(t, err)
|
||||
|
||||
if testcase.ComposeRequest.Distro != hostDistroName {
|
||||
t.Skipf("the required distro is %s, the host distro is %s", testcase.ComposeRequest.Distro, hostDistroName)
|
||||
}
|
||||
}
|
||||
|
||||
runTestcase(t, testcase)
|
||||
})
|
||||
|
||||
|
|
@ -339,5 +323,5 @@ func TestImages(t *testing.T) {
|
|||
require.Nil(t, err)
|
||||
}
|
||||
|
||||
runTests(t, cases, *distroArg)
|
||||
runTests(t, cases)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue