Skip to content

Commit

Permalink
libct/intelrdt: fix unit test
Browse files Browse the repository at this point in the history
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: 2c70d23
Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed May 5, 2021
1 parent f9176c9 commit e1d842c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libcontainer/intelrdt/intelrdt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e1d842c

Please sign in to comment.