From e1d842cfa6661fe32bcb88bc8d3614729c699307 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 5 May 2021 13:08:49 -0700 Subject: [PATCH] libct/intelrdt: fix unit test 1. These tests can't be run in parallel since they do check a global variable (mbaScEnabled). 2. findIntelRdtMountpointDir() relies on mbaScEnabled to be initially set to the default value (false) and this the test fails if run more than once: > go test -count 2 > ... > intelrdt_test.go:243: expected mbaScEnabled=false, got true > --- FAIL: TestFindIntelRdtMountpointDir/Valid_mountinfo_with_MBA_Software_Controller_disabled (0.00s) Fixes: 2c70d2384 Signed-off-by: Kir Kolyshkin --- libcontainer/intelrdt/intelrdt_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcontainer/intelrdt/intelrdt_test.go b/libcontainer/intelrdt/intelrdt_test.go index 485442d723d..ef7abd33f5c 100644 --- a/libcontainer/intelrdt/intelrdt_test.go +++ b/libcontainer/intelrdt/intelrdt_test.go @@ -217,10 +217,10 @@ func TestFindIntelRdtMountpointDir(t *testing.T) { }, } - t.Parallel() for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { + mbaScEnabled = false mp, err := findIntelRdtMountpointDir(tc.input) if tc.isNotFoundError { if !IsNotFound(err) {