Attempt to clarify the structure of our tests. Each test case is now encapsulated in a script in `test/cases`. Each of these scripts should be runnable on a pristine machine and be independent of each other. It is up to the test-orchestractor to decide if they should be run consequtively instance, or in parallel on separate instances. Each script can execute several tests and call whatever helper binaries is desired. However, each case should be assumed to always run as one.
36 lines
961 B
Go
36 lines
961 B
Go
package distro_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/osbuild/osbuild-composer/internal/distro"
|
|
"github.com/osbuild/osbuild-composer/internal/distro/distro_test_common"
|
|
"github.com/osbuild/osbuild-composer/internal/distro/fedora32"
|
|
"github.com/osbuild/osbuild-composer/internal/distro/fedora33"
|
|
"github.com/osbuild/osbuild-composer/internal/distro/rhel8"
|
|
)
|
|
|
|
func TestDistro_Manifest(t *testing.T) {
|
|
distro_test_common.TestDistro_Manifest(
|
|
t,
|
|
"../../test/data/manifests/",
|
|
"*",
|
|
fedora32.New(), fedora33.New(), rhel8.New(),
|
|
)
|
|
}
|
|
|
|
// Test that all distros are registered properly and that Registry.List() works.
|
|
func TestDistro_RegistryList(t *testing.T) {
|
|
expected := []string{
|
|
"fedora-32",
|
|
"fedora-33",
|
|
"rhel-8",
|
|
}
|
|
|
|
distros, err := distro.NewRegistry(fedora32.New(), fedora33.New(), rhel8.New())
|
|
require.NoError(t, err)
|
|
|
|
require.Equalf(t, expected, distros.List(), "unexpected list of distros")
|
|
}
|