Skip to content

Commit

Permalink
fix(test): add parallel statement for qrm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
csfldf committed May 6, 2024
1 parent 17410b8 commit 2c36e29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2544,6 +2544,7 @@ func TestGetSocketTopology(t *testing.T) {
}
}
func TestAllocationInfo_GetSpecifiedNUMABindingPoolName(t *testing.T) {
t.Parallel()
testName := "test"

type fields struct {
Expand Down Expand Up @@ -2706,6 +2707,7 @@ func TestAllocationInfo_GetSpecifiedNUMABindingPoolName(t *testing.T) {
}
for _, tt := range tests {

Check failure on line 2708 in pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state_test.go

View workflow job for this annotation

GitHub Actions / Parallel

Range statement for test TestAllocationInfo_GetSpecifiedNUMABindingPoolName does not reinitialise the variable tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
ai := &AllocationInfo{
PodUid: tt.fields.PodUid,

Check failure on line 2712 in pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state_test.go

View workflow job for this annotation

GitHub Actions / Lint

loopclosure: loop variable tt captured by func literal (govet)
PodNamespace: tt.fields.PodNamespace,

Check failure on line 2713 in pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state_test.go

View workflow job for this annotation

GitHub Actions / Lint

loopclosure: loop variable tt captured by func literal (govet)
Expand Down Expand Up @@ -2740,6 +2742,7 @@ func TestAllocationInfo_GetSpecifiedNUMABindingPoolName(t *testing.T) {
}

func TestCheckNUMABindingSharedCoresAntiAffinity(t *testing.T) {
t.Parallel()
testName := "test"
type args struct {
ai *AllocationInfo
Expand Down Expand Up @@ -2868,6 +2871,7 @@ func TestCheckNUMABindingSharedCoresAntiAffinity(t *testing.T) {
}
for _, tt := range tests {

Check failure on line 2872 in pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state_test.go

View workflow job for this annotation

GitHub Actions / Parallel

Range statement for test TestCheckNUMABindingSharedCoresAntiAffinity does not reinitialise the variable tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CheckNUMABindingSharedCoresAntiAffinity(tt.args.ai, tt.args.annotations); got != tt.want {
t.Errorf("CheckNUMABindingSharedCoresAntiAffinity() = %v, want %v", got, tt.want)
}
Expand All @@ -2876,6 +2880,7 @@ func TestCheckNUMABindingSharedCoresAntiAffinity(t *testing.T) {
}

func TestPodEntries_GetFilteredPoolsCPUSetMap(t *testing.T) {
t.Parallel()
testName := "test"
type args struct {
ignorePools sets.String
Expand Down Expand Up @@ -3090,6 +3095,7 @@ func TestPodEntries_GetFilteredPoolsCPUSetMap(t *testing.T) {
}
for _, tt := range tests {

Check failure on line 3096 in pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/state_test.go

View workflow job for this annotation

GitHub Actions / Parallel

Range statement for test TestPodEntries_GetFilteredPoolsCPUSetMap does not reinitialise the variable tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got, err := tt.pe.GetFilteredPoolsCPUSetMap(tt.args.ignorePools)
if (err != nil) != tt.wantErr {
t.Errorf("PodEntries.GetFilteredPoolsCPUSetMap() error = %v, wantErr %v", err, tt.wantErr)
Expand Down
2 changes: 2 additions & 0 deletions pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ func TestGetSpecifiedPoolName(t *testing.T) {
}

func TestCountAllocationInfosToPoolsQuantityMap(t *testing.T) {
t.Parallel()
testName := "test"
SetContainerRequestedCores(func(allocationInfo *AllocationInfo) float64 {
return allocationInfo.RequestQuantity
Expand Down Expand Up @@ -849,6 +850,7 @@ func TestCountAllocationInfosToPoolsQuantityMap(t *testing.T) {
}
for _, tt := range tests {

Check failure on line 851 in pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/util_test.go

View workflow job for this annotation

GitHub Actions / Parallel

Range statement for test TestCountAllocationInfosToPoolsQuantityMap does not reinitialise the variable tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if err := CountAllocationInfosToPoolsQuantityMap(tt.args.allocationInfos, tt.args.poolsQuantityMap); (err != nil) != tt.wantErr {
t.Errorf("CountAllocationInfosToPoolsQuantityMap() error = %v, wantErr %v", err, tt.wantErr)
} else if err == nil {
Expand Down

0 comments on commit 2c36e29

Please sign in to comment.