Skip to content

Commit 3a1778e

Browse files
authored
Merge pull request #815 from l1b0k/feat/test
test(network): add pod-to-pod connectivity tests
2 parents 329f68d + 374b93e commit 3a1778e

File tree

4 files changed

+457
-21
lines changed

4 files changed

+457
-21
lines changed

Diff for: tests/connecctive_test.go renamed to tests/connective_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func getStack() []string {
3333
return r
3434
}
3535

36-
func TestConnective(t *testing.T) {
36+
func TestNormal_Connective(t *testing.T) {
3737
var feats []features.Feature
3838

3939
type PodConfig struct {
@@ -392,7 +392,7 @@ func TestConnective(t *testing.T) {
392392
}
393393
}
394394

395-
func TestNetworkPolicy(t *testing.T) {
395+
func TestNormal_NetworkPolicy(t *testing.T) {
396396
if !testNetworkPolicy {
397397
t.Log("Skip networkPolicy tests")
398398
return

Diff for: tests/main_test.go

+1-14
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func TestMain(m *testing.M) {
9595
panic("error get home path")
9696
}
9797
envCfg := envconf.NewWithKubeConfig(filepath.Join(home, ".kube", "config")).
98-
WithRandomNamespace()
98+
WithRandomNamespace().WithParallelTestEnabled()
9999

100100
testenv = env.NewWithConfig(envCfg)
101101
testenv.Setup(
@@ -135,19 +135,6 @@ func TestMain(m *testing.M) {
135135
return ctx, nil
136136
})
137137

138-
testenv.Finish(func(ctx context.Context, config *envconf.Config) (context.Context, error) {
139-
if !isFailed.Load() {
140-
return envfuncs.DeleteNamespace(envCfg.Namespace())(ctx, config)
141-
}
142-
143-
pn := &networkv1beta1.PodNetworking{}
144-
pn.Name = "trunk"
145-
pn.Spec.ENIOptions = networkv1beta1.ENIOptions{ENIAttachType: networkv1beta1.ENIOptionTypeTrunk}
146-
147-
_ = config.Client().Resources().Delete(ctx, pn)
148-
return ctx, nil
149-
})
150-
151138
os.Exit(testenv.Run(m))
152139
}
153140

Diff for: tests/trunk_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
terwayTypes "github.com/AliyunContainerService/terway/types"
2626
)
2727

28-
func TestCreatePodNetworking(t *testing.T) {
28+
func TestNormal_CreatePodNetworking(t *testing.T) {
2929
defaultConfig := func() features.Feature {
3030
pnName := "empty-pn"
3131

@@ -115,7 +115,7 @@ func TestCreatePodNetworking(t *testing.T) {
115115
testenv.TestInParallel(t, defaultConfig, defaultVSwitch, defaultSecurityGroup)
116116
}
117117

118-
func TestSelector(t *testing.T) {
118+
func TestNormal_Selector(t *testing.T) {
119119
podSelector := func() features.Feature {
120120
pnName := "pn-pod-selector"
121121
podName := "pod-selector"
@@ -234,7 +234,7 @@ func TestSelector(t *testing.T) {
234234
testenv.TestInParallel(t, podSelector, nsSelector)
235235
}
236236

237-
func TestZoneLimit(t *testing.T) {
237+
func TestNormal_ZoneLimit(t *testing.T) {
238238
zoneLimit := func() features.Feature {
239239
pnName := "zone-limit"
240240
podName := "zone-limit"
@@ -374,7 +374,7 @@ func TestZoneLimit(t *testing.T) {
374374
testenv.Test(t, zoneLimit)
375375
}
376376

377-
func TestFixedIP(t *testing.T) {
377+
func TestNormal_FixedIP(t *testing.T) {
378378
fixedIP := func() features.Feature {
379379
pnName := "fixed-ip"
380380
return features.New("FixedIP").WithLabel("env", "trunking").
@@ -499,7 +499,7 @@ func TestFixedIP(t *testing.T) {
499499
testenv.Test(t, fixedIP)
500500
}
501501

502-
func TestExclusiveENI(t *testing.T) {
502+
func TestNormal_ExclusiveENI(t *testing.T) {
503503
exclusiveENI := func() features.Feature {
504504
pnName := "exclusive-eni"
505505
podName := "exclusive-eni"

0 commit comments

Comments
 (0)