summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-01-27 14:18:12 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-01-27 14:18:12 +0100
commitfee2fadc3cdbe84a88148c27fac819748474cfc3 (patch)
treeb1e30c5431e79d375830eb66b7e5b4caebaefecc /test
parent6ba8819d336ed3514b57c5818123ddfac80555ef (diff)
downloadpodman-fee2fadc3cdbe84a88148c27fac819748474cfc3.tar.gz
podman-fee2fadc3cdbe84a88148c27fac819748474cfc3.tar.bz2
podman-fee2fadc3cdbe84a88148c27fac819748474cfc3.zip
e2e tests: synchronize test results
Use a mutex to synchronize the slice for storing tests results. Running the e2e tests in parallel is otherwise subject to race conditions surfacing in lost entries. Fixes: #8358 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/common_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 2668b1e7b..781bbb6d2 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -10,6 +10,7 @@ import (
"sort"
"strconv"
"strings"
+ "sync"
"testing"
"time"
@@ -84,6 +85,7 @@ type testResultsSortedLength struct{ testResultsSorted }
func (a testResultsSorted) Less(i, j int) bool { return a[i].length < a[j].length }
var testResults []testResult
+var testResultsMutex sync.Mutex
func TestMain(m *testing.M) {
if reexec.Init() {
@@ -349,7 +351,9 @@ func (p *PodmanTestIntegration) InspectContainer(name string) []define.InspectCo
func processTestResult(f GinkgoTestDescription) {
tr := testResult{length: f.Duration.Seconds(), name: f.TestText}
+ testResultsMutex.Lock()
testResults = append(testResults, tr)
+ testResultsMutex.Unlock()
}
func GetPortLock(port string) storage.Locker {