Enable paralellism in scheduler unit tests

Unit tests run in parallel at the package level. This change allows the
execution of sig/scheduling unit tests in parallel.

Signed-off-by: Victor Morales <v.morales@samsung.com>
This commit is contained in:
Victor Morales
2022-09-14 11:10:57 -07:00
parent c45ca46cdb
commit f37ab167f8
4 changed files with 79 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ import (
)
func TestSchedulerWithExtenders(t *testing.T) {
t.Parallel()
tests := []struct {
name string
registerPlugins []st.RegisterPluginFunc
@@ -330,6 +331,7 @@ func createNode(name string) *v1.Node {
}
func TestIsInterested(t *testing.T) {
t.Parallel()
mem := &HTTPExtender{
managedResources: sets.NewString(),
}
@@ -372,7 +374,9 @@ func TestIsInterested(t *testing.T) {
want: true,
},
} {
tc := tc
t.Run(tc.label, func(t *testing.T) {
t.Parallel()
if got := tc.extender.IsInterested(tc.pod); got != tc.want {
t.Fatalf("IsInterested(%v) = %v, wanted %v", tc.pod, got, tc.want)
}
@@ -381,6 +385,7 @@ func TestIsInterested(t *testing.T) {
}
func TestConvertToMetaVictims(t *testing.T) {
t.Parallel()
tests := []struct {
name string
nodeNameToVictims map[string]*extenderv1.Victims
@@ -423,7 +428,9 @@ func TestConvertToMetaVictims(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := convertToMetaVictims(tt.nodeNameToVictims); !reflect.DeepEqual(got, tt.want) {
t.Errorf("convertToMetaVictims() = %v, want %v", got, tt.want)
}
@@ -432,6 +439,7 @@ func TestConvertToMetaVictims(t *testing.T) {
}
func TestConvertToVictims(t *testing.T) {
t.Parallel()
tests := []struct {
name string
httpExtender *HTTPExtender
@@ -488,7 +496,9 @@ func TestConvertToVictims(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
// nodeInfos instantiations
nodeInfoList := make([]*framework.NodeInfo, 0, len(tt.nodeNames))
for i, nm := range tt.nodeNames {