Skip to content

Commit 3288c83

Browse files
committed
E2E tests IP Family support
The IP-Family is now a parameter of the e2e tests. The tests can be now run with only IPv4, only IPv6 or dualstack.
1 parent 651bdbc commit 3288c83

21 files changed

+594
-75
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ LOCAL_VERSION ?= $(VERSION)
2929

3030
# E2E tests
3131
E2E_FOCUS ?= ""
32-
E2E_PARAMETERS ?= $(shell cat ./test/e2e/environment/kind-helm/config.txt | tr '\n' ' ')
32+
E2E_PARAMETERS ?= $(shell cat ./test/e2e/environment/kind-helm/dualstack/config.txt | tr '\n' ' ')
3333
E2E_SEED ?= $(shell shuf -i 1-2147483647 -n1)
3434

3535
# Contrainer Registry

docs/test.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#### Initial Deployment
88

9-
The picture below shows the initial deployment that should be installed in a kubernetes cluster in order to execute the complete e2e test suite. Elements between `[]` are configurable via parameters, see the `Configuration` section.
9+
The picture below shows the initial deployment that should be installed in a kubernetes cluster in order to execute the complete e2e test suite in dualstack. With only IPv4, elements containing `v6` are not used, and with only IPv6, elements containing `v4` are not used. Elements between `[]` are configurable via parameters, see the `Configuration` section.
1010

1111
![Initial-Deployment-E2E](resources/Initial-Deployment-E2E.svg)
1212

@@ -40,7 +40,7 @@ The picture below shows the initial deployment that should be installed in a kub
4040
| vip-2-v6 | string | Address of the vip v6 number 2 |
4141
| | | |
4242
| stateless-lb-fe-deployment-name | string | Name of stateless-lb-fe deployment in `trench-a` |
43-
<!-- TODO: | ip-family | string | IP Family | -->
43+
| ip-family | string | IP Family |
4444

4545
For more details about each parameter, check the picture above in the `Initial Deployment` section.
4646

test/e2e/configuration_test.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,18 @@ var _ = Describe("Configuration", func() {
4949
})
5050

5151
It("should receive the traffic correctly", func() {
52-
By("Checking if all targets have receive traffic via the new VIP with no traffic interruption (no lost connection)")
53-
lastingConnections, lostConnections := trafficGeneratorHost.SendTraffic(trafficGenerator, config.trenchA, config.k8sNamespace, utils.VIPPort(config.vip2V4, config.flowAZTcpDestinationPort0), "tcp")
54-
Expect(lostConnections).To(Equal(0))
55-
Expect(len(lastingConnections)).To(Equal(numberOfTargetA))
52+
if !utils.IsIPv6(config.ipFamily) { // Don't send traffic with IPv4 if the tests are only IPv6
53+
By("Checking if all targets have receive ipv4 traffic via the new VIP with no traffic interruption (no lost connection)")
54+
lastingConnections, lostConnections := trafficGeneratorHost.SendTraffic(trafficGenerator, config.trenchA, config.k8sNamespace, utils.VIPPort(config.vip2V4, config.flowAZTcpDestinationPort0), "tcp")
55+
Expect(lostConnections).To(Equal(0))
56+
Expect(len(lastingConnections)).To(Equal(numberOfTargetA))
57+
}
58+
if !utils.IsIPv4(config.ipFamily) { // Don't send traffic with IPv6 if the tests are only IPv4
59+
By("Checking if all targets have receive ipv6 traffic via the new VIP with no traffic interruption (no lost connection)")
60+
lastingConnections, lostConnections := trafficGeneratorHost.SendTraffic(trafficGenerator, config.trenchA, config.k8sNamespace, utils.VIPPort(config.vip2V6, config.flowAZTcpDestinationPort0), "tcp")
61+
Expect(lostConnections).To(Equal(0))
62+
Expect(len(lastingConnections)).To(Equal(numberOfTargetA))
63+
}
5664
})
5765
})
5866

test/e2e/e2e_suite_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ type e2eTestConfiguration struct {
7070
vip2V6 string
7171

7272
statelessLbFeDeploymentName string
73+
ipFamily string
7374
}
7475

7576
const (
@@ -105,6 +106,7 @@ func init() {
105106
flag.StringVar(&config.vip2V6, "vip-2-v6", "", "Address of the vip v6 number 2")
106107

107108
flag.StringVar(&config.statelessLbFeDeploymentName, "stateless-lb-fe-deployment-name", "", "Name of stateless-lb-fe deployment in trench-a")
109+
flag.StringVar(&config.ipFamily, "ip-family", "", "IP Family")
108110
}
109111

110112
func TestE2e(t *testing.T) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-traffic-generator-cmd="docker exec -i {trench}"
2+
-script="./environment/kind-helm/dualstack/test.sh"
3+
-k8s-namespace="red"
4+
-target-a-deployment-name="target-a"
5+
-trench-a="trench-a"
6+
-attractor-a-1="attractor-a"
7+
-conduit-a-1="load-balancer"
8+
-stream-a-I="stream-a"
9+
-stream-a-II="stream-b"
10+
-flow-a-z-tcp=""
11+
-flow-a-z-tcp-destination-port-0=4000
12+
-flow-a-z-udp=""
13+
-flow-a-z-udp-destination-port-0=4003
14+
-flow-a-x-tcp=""
15+
-flow-a-x-tcp-destination-port-0=4001
16+
-vip-1-v4="20.0.0.1"
17+
-vip-1-v6="[2000::1]"
18+
-target-b-deployment-name="target-b"
19+
-trench-b="trench-b"
20+
-conduit-b-1="load-balancer"
21+
-stream-b-I="stream-a"
22+
-vip-2-v4="60.0.0.150"
23+
-vip-2-v6="[6000::150]"
24+
-stateless-lb-fe-deployment-name="load-balancer-trench-a"
25+
-ip-family="dualstack"

test/e2e/environment/kind-helm/configuration/configuration-new-vip.yaml renamed to test/e2e/environment/kind-helm/dualstack/configuration/configuration-new-vip.yaml

+19-8
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,41 @@ data:
1717
vips:
1818
- vip1
1919
- vip2
20+
- vip3
2021
- vip4
2122
source-subnets:
2223
- 0.0.0.0/0
2324
- 0:0:0:0:0:0:0:0/0
2425
destination-port-ranges:
25-
- 5000
2626
- 4000
27-
- 5003
28-
- 4003
2927
source-port-ranges:
3028
- 1024-65535
3129
protocols:
3230
- tcp
31+
stream: stream-a
32+
- name: flow-b
33+
vips:
34+
- vip1
35+
- vip2
36+
source-subnets:
37+
- 0.0.0.0/0
38+
- 0:0:0:0:0:0:0:0/0
39+
destination-port-ranges:
40+
- 4003
41+
source-port-ranges:
42+
- 1024-65535
43+
protocols:
3344
- udp
3445
stream: stream-a
3546
- name: flow-b
3647
vips:
37-
- vip3
48+
- vip1
49+
- vip2
3850
source-subnets:
3951
- 0.0.0.0/0
4052
- 0:0:0:0:0:0:0:0/0
4153
destination-port-ranges:
42-
- 5000
43-
- 4000
54+
- 4001
4455
source-port-ranges:
4556
- 1024-65535
4657
protocols:
@@ -55,10 +66,10 @@ data:
5566
address: 2000::1/128
5667
trench: trench-a
5768
- name: vip3
58-
address: 40.0.0.0/24
69+
address: 60.0.0.150/32
5970
trench: trench-a
6071
- name: vip4
61-
address: 60.0.0.150/32
72+
address: 6000::150/128
6273
trench: trench-a
6374
attractors: |
6475
items:

test/e2e/environment/kind-helm/configuration/init.yaml renamed to test/e2e/environment/kind-helm/dualstack/configuration/init.yaml

+16-10
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,35 @@ data:
2121
- 0.0.0.0/0
2222
- 0:0:0:0:0:0:0:0/0
2323
destination-port-ranges:
24-
- 5000
2524
- 4000
26-
- 5003
27-
- 4003
2825
source-port-ranges:
2926
- 1024-65535
3027
protocols:
3128
- tcp
29+
stream: stream-a
30+
- name: flow-b
31+
vips:
32+
- vip1
33+
- vip2
34+
source-subnets:
35+
- 0.0.0.0/0
36+
- 0:0:0:0:0:0:0:0/0
37+
destination-port-ranges:
38+
- 4003
39+
source-port-ranges:
40+
- 1024-65535
41+
protocols:
3242
- udp
3343
stream: stream-a
3444
- name: flow-b
3545
vips:
36-
- vip3
46+
- vip1
47+
- vip2
3748
source-subnets:
3849
- 0.0.0.0/0
3950
- 0:0:0:0:0:0:0:0/0
4051
destination-port-ranges:
41-
- 5000
42-
- 4000
52+
- 4001
4353
source-port-ranges:
4454
- 1024-65535
4555
protocols:
@@ -53,16 +63,12 @@ data:
5363
- name: vip2
5464
address: 2000::1/128
5565
trench: trench-a
56-
- name: vip3
57-
address: 40.0.0.0/24
58-
trench: trench-a
5966
attractors: |
6067
items:
6168
- name: attractor-a
6269
vips:
6370
- vip1
6471
- vip2
65-
- vip3
6672
gateways:
6773
- gateway1
6874
- gateway2
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
-traffic-generator-cmd="docker exec -i {trench}"
2-
-script="./environment/kind-helm/test.sh"
2+
-script="./environment/kind-helm/ipv4/test.sh"
33
-k8s-namespace="red"
44
-target-a-deployment-name="target-a"
55
-trench-a="trench-a"
6-
-attractor-a-1=""
6+
-attractor-a-1="attractor-a"
77
-conduit-a-1="load-balancer"
88
-stream-a-I="stream-a"
9-
-stream-a-II=""
9+
-stream-a-II="stream-b"
1010
-flow-a-z-tcp=""
1111
-flow-a-z-tcp-destination-port-0=4000
1212
-flow-a-z-udp=""
1313
-flow-a-z-udp-destination-port-0=4003
1414
-flow-a-x-tcp=""
1515
-flow-a-x-tcp-destination-port-0=4001
1616
-vip-1-v4="20.0.0.1"
17-
-vip-1-v6="[2000::1]"
17+
-vip-1-v6=""
1818
-target-b-deployment-name="target-b"
1919
-trench-b="trench-b"
2020
-conduit-b-1="load-balancer"
2121
-stream-b-I="stream-a"
2222
-vip-2-v4="60.0.0.150"
2323
-vip-2-v6=""
24-
-stateless-lb-fe-deployment-name="load-balancer-trench-a"
24+
-stateless-lb-fe-deployment-name="load-balancer-trench-a"
25+
-ip-family="ipv4"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
data:
2+
trench: |
3+
name: trench-a
4+
conduits: |
5+
items:
6+
- name: load-balancer
7+
trench: trench-a
8+
streams: |
9+
items:
10+
- name: stream-a
11+
conduit: load-balancer
12+
- name: stream-b
13+
conduit: load-balancer
14+
flows: |
15+
items:
16+
- name: flow-a
17+
vips:
18+
- vip1
19+
- vip3
20+
source-subnets:
21+
- 0.0.0.0/0
22+
destination-port-ranges:
23+
- 4000
24+
source-port-ranges:
25+
- 1024-65535
26+
protocols:
27+
- tcp
28+
stream: stream-a
29+
- name: flow-b
30+
vips:
31+
- vip1
32+
source-subnets:
33+
- 0.0.0.0/0
34+
destination-port-ranges:
35+
- 4003
36+
source-port-ranges:
37+
- 1024-65535
38+
protocols:
39+
- udp
40+
stream: stream-a
41+
- name: flow-b
42+
vips:
43+
- vip1
44+
source-subnets:
45+
- 0.0.0.0/0
46+
destination-port-ranges:
47+
- 4001
48+
source-port-ranges:
49+
- 1024-65535
50+
protocols:
51+
- tcp
52+
stream: stream-b
53+
vips: |
54+
items:
55+
- name: vip1
56+
address: 20.0.0.1/32
57+
trench: trench-a
58+
- name: vip3
59+
address: 60.0.0.150/32
60+
trench: trench-a
61+
attractors: |
62+
items:
63+
- name: attractor-a
64+
vips:
65+
- vip1
66+
- vip3
67+
gateways:
68+
- gateway1
69+
trench: trench-a
70+
gateways: |
71+
items:
72+
- name: gateway1
73+
address: 169.254.100.150
74+
ip-family: ipv4
75+
bfd: false
76+
protocol: bgp
77+
trench: trench-a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
data:
2+
trench: |
3+
name: trench-a
4+
conduits: |
5+
items:
6+
- name: load-balancer
7+
trench: trench-a
8+
streams: |
9+
items:
10+
- name: stream-a
11+
conduit: load-balancer
12+
- name: stream-b
13+
conduit: load-balancer
14+
flows: |
15+
items:
16+
- name: flow-a
17+
vips:
18+
- vip1
19+
source-subnets:
20+
- 0.0.0.0/0
21+
destination-port-ranges:
22+
- 4000
23+
source-port-ranges:
24+
- 1024-65535
25+
protocols:
26+
- tcp
27+
stream: stream-a
28+
- name: flow-b
29+
vips:
30+
- vip1
31+
source-subnets:
32+
- 0.0.0.0/0
33+
destination-port-ranges:
34+
- 4003
35+
source-port-ranges:
36+
- 1024-65535
37+
protocols:
38+
- udp
39+
stream: stream-a
40+
- name: flow-b
41+
vips:
42+
- vip1
43+
source-subnets:
44+
- 0.0.0.0/0
45+
destination-port-ranges:
46+
- 4001
47+
source-port-ranges:
48+
- 1024-65535
49+
protocols:
50+
- tcp
51+
stream: stream-b
52+
vips: |
53+
items:
54+
- name: vip1
55+
address: 20.0.0.1/32
56+
trench: trench-a
57+
attractors: |
58+
items:
59+
- name: attractor-a
60+
vips:
61+
- vip1
62+
gateways:
63+
- gateway1
64+
trench: trench-a
65+
gateways: |
66+
items:
67+
- name: gateway1
68+
address: 169.254.100.150
69+
ip-family: ipv4
70+
bfd: false
71+
protocol: bgp
72+
trench: trench-a

0 commit comments

Comments
 (0)