From de3c3baf096016df93cfee09e3d9d6054c06c9ba Mon Sep 17 00:00:00 2001 From: flouthoc Date: Mon, 3 Feb 2025 21:37:02 -0800 Subject: [PATCH] unit: deparallize some tests See issue: https://github.com/containers/buildah/issues/5967 Signed-off-by: flouthoc --- buildah_test.go | 7 ++++++- commit_test.go | 7 ++++++- convertcw_test.go | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/buildah_test.go b/buildah_test.go index ee906e80f..f9387260a 100644 --- a/buildah_test.go +++ b/buildah_test.go @@ -40,7 +40,12 @@ func TestMain(m *testing.M) { } func TestOpenBuilderCommonBuildOpts(t *testing.T) { - t.Parallel() + // This test cannot be parallized as this uses NewBuilder() + // which eventually and indirectly accesses a global variable + // defined in `go-selinux`, this must be fixed at `go-selinux` + // or builder must enable sometime of locking mechanism i.e if + // routine is creating Builder other's must wait for it. + // Tracked here: https://github.com/containers/buildah/issues/5967 ctx := context.TODO() store, err := storage.GetStore(types.StoreOptions{ RunRoot: t.TempDir(), diff --git a/commit_test.go b/commit_test.go index 9fac7797d..9eca89a66 100644 --- a/commit_test.go +++ b/commit_test.go @@ -21,7 +21,12 @@ import ( ) func TestCommitLinkedLayers(t *testing.T) { - t.Parallel() + // This test cannot be parallized as this uses NewBuilder() + // which eventually and indirectly accesses a global variable + // defined in `go-selinux`, this must be fixed at `go-selinux` + // or builder must enable sometime of locking mechanism i.e if + // routine is creating Builder other's must wait for it. + // Tracked here: https://github.com/containers/buildah/issues/5967 ctx := context.TODO() now := time.Now() diff --git a/convertcw_test.go b/convertcw_test.go index a5dcb4d80..42a0dba1e 100644 --- a/convertcw_test.go +++ b/convertcw_test.go @@ -66,7 +66,12 @@ func (d *dummyAttestationHandler) ServeHTTP(rw http.ResponseWriter, req *http.Re } func TestCWConvertImage(t *testing.T) { - t.Parallel() + // This test cannot be parallized as this uses NewBuilder() + // which eventually and indirectly accesses a global variable + // defined in `go-selinux`, this must be fixed at `go-selinux` + // or builder must enable sometime of locking mechanism i.e if + // routine is creating Builder other's must wait for it. + // Tracked here: https://github.com/containers/buildah/issues/5967 ctx := context.TODO() for _, status := range []int{http.StatusOK, http.StatusInternalServerError} { for _, ignoreChainRetrievalErrors := range []bool{false, true} {