-
Notifications
You must be signed in to change notification settings - Fork 17
/
suite.gen.go
executable file
·175 lines (171 loc) · 12.8 KB
/
suite.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Code generated by gotestmd DO NOT EDIT.
package basic
import (
"github.com/stretchr/testify/suite"
"github.com/networkservicemesh/integration-tests/extensions/base"
"github.com/networkservicemesh/integration-tests/suites/spire/single_cluster"
)
type Suite struct {
base.Suite
single_clusterSuite single_cluster.Suite
}
func (s *Suite) SetupSuite() {
parents := []interface{}{&s.Suite, &s.single_clusterSuite}
for _, p := range parents {
if v, ok := p.(suite.TestingSuite); ok {
v.SetT(s.T())
}
if v, ok := p.(suite.SetupAllSuite); ok {
v.SetupSuite()
}
}
r := s.Runner("../deployments-k8s/examples/basic")
s.T().Cleanup(func() {
r.Run(`kubectl delete mutatingwebhookconfiguration nsm-mutating-webhook` + "\n" + `kubectl delete ns nsm-system`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/basic?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')` + "\n" + `kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system`)
}
func (s *Suite) TestKernel2Ethernet2Kernel() {
r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-kernel2ethernet2kernel`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Kernel?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2kernel`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ethernet2kernel`)
r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.100`)
r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ethernet2kernel -- ping -c 4 172.16.1.101`)
}
func (s *Suite) TestKernel2Ethernet2Memif() {
r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Ethernet2Memif")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-kernel2ethernet2memif`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Ethernet2Memif?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ethernet2memif`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2ethernet2memif`)
r.Run(`kubectl exec pods/alpine -n ns-kernel2ethernet2memif -- ping -c 4 172.16.1.100`)
r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2ethernet2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
}
func (s *Suite) TestKernel2IP2Kernel() {
r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2IP2Kernel")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-kernel2ip2kernel`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2IP2Kernel?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2kernel`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2ip2kernel`)
r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2kernel -- ping -c 4 172.16.1.100`)
r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2ip2kernel -- ping -c 4 172.16.1.101`)
}
func (s *Suite) TestKernel2IP2Memif() {
r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2IP2Memif")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-kernel2ip2memif`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2IP2Memif?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2ip2memif`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2ip2memif`)
r.Run(`kubectl exec pods/alpine -n ns-kernel2ip2memif -- ping -c 4 172.16.1.100`)
r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2ip2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
}
func (s *Suite) TestKernel2Kernel() {
r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Kernel")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-kernel2kernel`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Kernel?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel`)
r.Run(`kubectl exec pods/alpine -n ns-kernel2kernel -- ping -c 4 172.16.1.100`)
r.Run(`kubectl exec deployments/nse-kernel -n ns-kernel2kernel -- ping -c 4 172.16.1.101`)
}
func (s *Suite) TestKernel2Memif() {
r := s.Runner("../deployments-k8s/examples/use-cases/Kernel2Memif")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-kernel2memif`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Kernel2Memif?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2memif`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-kernel2memif`)
r.Run(`kubectl exec pods/alpine -n ns-kernel2memif -- ping -c 4 172.16.1.100`)
r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-kernel2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
}
func (s *Suite) TestMemif2Ethernet2Kernel() {
r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Ethernet2Kernel")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-memif2ethernet2kernel`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Ethernet2Kernel?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ethernet2kernel`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2ethernet2kernel`)
r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ethernet2kernel" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2ethernet2kernel -- ping -c 4 172.16.1.101`)
}
func (s *Suite) TestMemif2Ethernet2Memif() {
r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Ethernet2Memif")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-memif2ethernet2memif`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Ethernet2Memif?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ethernet2memif`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2ethernet2memif`)
r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ethernet2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2ethernet2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
}
func (s *Suite) TestMemif2IP2Kernel() {
r := s.Runner("../deployments-k8s/examples/use-cases/Memif2IP2Kernel")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-memif2ip2kernel`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2IP2Kernel?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2kernel`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2ip2kernel`)
r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2kernel" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2ip2kernel -- ping -c 4 172.16.1.101`)
}
func (s *Suite) TestMemif2IP2Memif() {
r := s.Runner("../deployments-k8s/examples/use-cases/Memif2IP2Memif")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-memif2ip2memif`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2IP2Memif?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2ip2memif`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2ip2memif`)
r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2ip2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2ip2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
}
func (s *Suite) TestMemif2Kernel() {
r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Kernel")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-memif2kernel`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Kernel?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2kernel`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-memif2kernel`)
r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2kernel" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
r.Run(`kubectl exec deployments/nse-kernel -n ns-memif2kernel -- ping -c 4 172.16.1.101`)
}
func (s *Suite) TestMemif2Memif() {
r := s.Runner("../deployments-k8s/examples/use-cases/Memif2Memif")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-memif2memif`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/Memif2Memif?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2memif`)
r.Run(`kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2memif`)
r.Run(`result=$(kubectl exec deployments/nsc-memif -n "ns-memif2memif" -- vppctl ping 172.16.1.100 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
r.Run(`result=$(kubectl exec deployments/nse-memif -n "ns-memif2memif" -- vppctl ping 172.16.1.101 repeat 4)` + "\n" + `echo ${result}` + "\n" + `! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)"`)
}
func (s *Suite) TestVl3_basic() {
r := s.Runner("../deployments-k8s/examples/use-cases/vl3-basic")
s.T().Cleanup(func() {
r.Run(`kubectl delete ns ns-vl3`)
})
r.Run(`kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/use-cases/vl3-basic?ref=101d2bfa812f0943e4baedab398ff7169071425f`)
r.Run(`kubectl wait --for=condition=ready --timeout=2m pod -l app=alpine -n ns-vl3`)
r.Run(`nscs=$(kubectl get pods -l app=alpine -o go-template --template="{{range .items}}{{.metadata.name}} {{end}}" -n ns-vl3)` + "\n" + `[[ ! -z $nscs ]]`)
r.Run(`(` + "\n" + `for nsc in $nscs ` + "\n" + `do` + "\n" + ` ipAddr=$(kubectl exec -n ns-vl3 $nsc -- ifconfig nsm-1) || exit` + "\n" + ` ipAddr=$(echo $ipAddr | grep -Eo 'inet addr:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| cut -c 11-)` + "\n" + ` for pinger in $nscs` + "\n" + ` do` + "\n" + ` echo $pinger pings $ipAddr` + "\n" + ` kubectl exec $pinger -n ns-vl3 -- ping -c2 -i 0.5 $ipAddr || exit` + "\n" + ` done` + "\n" + `done` + "\n" + `)`)
r.Run(`(` + "\n" + `for nsc in $nscs ` + "\n" + `do` + "\n" + ` echo $nsc pings nses` + "\n" + ` kubectl exec -n ns-vl3 $nsc -- ping 172.16.0.0 -c2 -i 0.5 || exit` + "\n" + ` kubectl exec -n ns-vl3 $nsc -- ping 172.16.1.0 -c2 -i 0.5 || exit` + "\n" + `done` + "\n" + `)`)
}