From d02e77de06a990c59c1180dce37668721e31080a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Thu, 9 Jul 2020 14:28:19 +0200 Subject: [PATCH] Revert "tests/image: run the tests in parallel (somewhat)" Running tests in parallel is not stable under all conditions, this commit removes it to make the tests more reliable. This reverts commit e890e03d --- cmd/osbuild-image-tests/main_test.go | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/cmd/osbuild-image-tests/main_test.go b/cmd/osbuild-image-tests/main_test.go index de669cc64..164c46bcc 100644 --- a/cmd/osbuild-image-tests/main_test.go +++ b/cmd/osbuild-image-tests/main_test.go @@ -15,18 +15,17 @@ import ( "os/exec" "path" "strings" - "sync" "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/azuretest" - "github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/openstacktest" "github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/constants" + "github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/openstacktest" "github.com/osbuild/osbuild-composer/internal/common" ) @@ -45,18 +44,8 @@ type testcaseStruct struct { var disableLocalBoot = flag.Bool("disable-local-boot", false, "when this flag is given, no images are booted locally using qemu (this does not affect testing in clouds)") -// mutex to enforce only one osbuild instance run at a time, see below -var osbuildMutex sync.Mutex - // runOsbuild runs osbuild with the specified manifest and output-directory. func runOsbuild(manifest []byte, store, outputDirectory string) error { - // Osbuild crashes when multiple instances are run at a time. - // This mutex enforces that there's always just one osbuild instance. - // This should be removed once osbuild is fixed. - // See https://github.com/osbuild/osbuild/issues/351 - osbuildMutex.Lock() - defer osbuildMutex.Unlock() - cmd := constants.GetOsbuildCommand(store, outputDirectory) cmd.Stdin = bytes.NewReader(manifest) @@ -472,13 +461,6 @@ func runTests(t *testing.T, cases []string) { t.Skipf("the required arch is %s, the current arch is %s", testcase.ComposeRequest.Arch, currentArch) } - // Run the test in parallel - // The t.Parallel() call is after the skip conditions, because - // the skipped tests are short and there's no need to run - // them in parallel and create more goroutines. - // Also the output is clearer this way. - t.Parallel() - runTestcase(t, testcase, store) })