Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terway test:support skip trunk test #774

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions tests/connecctive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ func TestConnective(t *testing.T) {
}
mutateConfig := []PodConfig{}
if affinityLabel == "" {
mutateConfig = []PodConfig{
{
name: "normal config",
podFunc: func(pod *Pod) *Pod {
return pod
},
mutateConfig = []PodConfig{{
name: "normal config",
podFunc: func(pod *Pod) *Pod {
return pod
},
{
}}
if testTrunk {
mutateConfig = append(mutateConfig, PodConfig{
name: "trunk pod",
podFunc: func(pod *Pod) *Pod {
return pod.WithLabels(map[string]string{"netplan": "default"})
},
},
})
}
} else {
labelArr := strings.Split(affinityLabel, ":")
Expand All @@ -68,12 +68,14 @@ func TestConnective(t *testing.T) {
return pod.WithNodeAffinity(map[string]string{labelArr[0]: labelArr[1]})
},
},
{
name: fmt.Sprintf("trunk_%s", labelArr[0]),
}
if testTrunk {
mutateConfig = append(mutateConfig, PodConfig{
name: "trunk_trunk",
podFunc: func(pod *Pod) *Pod {
return pod.WithLabels(map[string]string{"netplan": "default"}).WithNodeAffinity(map[string]string{labelArr[0]: labelArr[1]})
},
},
})
}
}
for i := range mutateConfig {
Expand Down Expand Up @@ -410,12 +412,14 @@ func TestNetworkPolicy(t *testing.T) {
return pod
},
},
{
}
if testTrunk {
mutateConfig = append(mutateConfig, PodConfig{
name: "trunk pod",
podFunc: func(pod *Pod) *Pod {
return pod.WithLabels(map[string]string{"netplan": "default"})
},
},
})
}
} else {
labelArr := strings.Split(affinityLabel, ":")
Expand All @@ -429,12 +433,14 @@ func TestNetworkPolicy(t *testing.T) {
return pod.WithNodeAffinity(map[string]string{labelArr[0]: labelArr[1]})
},
},
{
}
if testTrunk {
mutateConfig = append(mutateConfig, PodConfig{
name: fmt.Sprintf("trunk_%s", labelArr[0]),
podFunc: func(pod *Pod) *Pod {
return pod.WithLabels(map[string]string{"netplan": "default"}).WithNodeAffinity(map[string]string{labelArr[0]: labelArr[1]})
},
},
})
}
}
for i := range mutateConfig {
Expand Down
5 changes: 3 additions & 2 deletions tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func init() {
flag.StringVar(&vSwitchIDs, "vswitch-ids", "", "extra vSwitchIDs")
flag.StringVar(&securityGroupIDs, "security-group-ids", "", "extra securityGroupIDs")
flag.StringVar(&affinityLabel, "label", "", "node affinity, format as key:value")
flag.BoolVar(&testTrunk, "enable-trunk", true, "enable trunk test")
defaultPodNetworkingName = "default-pn"
}

Expand Down Expand Up @@ -191,8 +192,8 @@ func checkENIConfig(ctx context.Context, config *envconf.Config) (context.Contex
if err != nil {
return nil, err
}
if cfg.EnableENITrunking {
testTrunk = true
if !cfg.EnableENITrunking {
testTrunk = false
testPodLevelConfig = true
}
if cfg.IPAMType == "crd" {
Expand Down
Loading