-
Notifications
You must be signed in to change notification settings - Fork 20
239 lines (192 loc) · 9.51 KB
/
run-tests.yaml
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: Run Tests
on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- master
env:
TIMEOUT: 15m
TYK_OSS_NS: tyk-oss
TYK_DATAPLANE_NS: tyk-dataplane
TYK_STACK_NS: tyk-stack
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
with:
version: v3.3.0
- name: Add dependencies
run: helm repo add tyk-helm https://helm.tyk.io/public/helm/charts/
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml --all
smoke-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
k8s_version: ["v1.26.13", "v1.27.10","v1.28.6","v1.29.1"]
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Create Kind Cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:${{ matrix.k8s_version }}"
- name: Install helm
uses: azure/setup-helm@v4
- name: Deploy Tyk OSS and Dependencies
run: |
kubectl create namespace ${{ env.TYK_OSS_NS }}
# Do not change the name
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }}
helm dependency update ./tyk-oss
helm install tyk-oss ./tyk-oss -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }} \
--set global.redis.addrs={redis-master.${{ env.TYK_OSS_NS }}.svc:6379} \
--set global.redis.passSecret.name=redis \
--set global.redis.passSecret.keyName=redis-password
- name: Upgrade Tyk OSS
run: |
helm upgrade -n ${{ env.TYK_OSS_NS }} tyk-oss ./tyk-oss --set tyk-gateway.gateway.kind=DaemonSet
- name: Uninstall Tyk OSS
run: |
helm uninstall tyk-oss -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_OSS_NS }}
- name: Deploy Tyk Data Plane
run: |
kubectl create namespace ${{ env. TYK_DATAPLANE_NS }}
# Do not change the name
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
helm dependency update ./tyk-data-plane
helm install --namespace ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --wait \
--set global.remoteControlPlane.orgId=${{ secrets.HYBRID_RPC_KEY }} \
--set global.remoteControlPlane.userApiKey=${{ secrets.HYBRID_API_KEY }} \
--set global.remoteControlPlane.connectionString=${{ secrets.HYBRID_MDCB_HOST }} \
--set global.redis.addrs={redis-master.${{ env.TYK_DATAPLANE_NS }}.svc:6379} \
--set global.redis.passSecret.name=redis \
--set global.redis.passSecret.keyName=redis-password
- name: Upgrade Tyk Data Plane
run: |
helm upgrade -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --set tyk-gateway.gateway.kind=DaemonSet
- name: Uninstall Tyk Data Plane
run: |
helm uninstall tyk-data-plane -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env. TYK_DATAPLANE_NS }}
integration-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:v1.29.1"
- name: Deploy OSS and Dependencies
id: deploy-oss
run: |
kubectl create namespace ${{ env.TYK_OSS_NS }}
# Do not change the name
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }} --version 19.0.2
helm dependency update ./tyk-oss
helm install --namespace ${{ env.TYK_OSS_NS }} tyk-oss ./tyk-oss \
--set "global.redis.addrs={redis-master.${{ env.TYK_OSS_NS }}.svc:6379}" \
--set "global.redis.passSecret.name=redis" \
--set "global.redis.passSecret.keyName=redis-password" \
--timeout=${{ env.TIMEOUT }}
- name: Run integration tests for Tyk OSS
id: test-oss
run: helm test -n ${{ env.TYK_OSS_NS }} tyk-oss
- if: failure()
name: Check logs in case of failure
run: |
if [ ${{ steps.deploy-oss.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env.TYK_OSS_NS }} gateway-tyk-oss-tyk-gateway
elif [ ${{ steps.test-oss.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env.TYK_OSS_NS }} tyk-oss-test-tyk-oss
fi
- name: Uninstall Tyk OSS Dependencies
run: |
helm uninstall redis -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_OSS_NS }}
- name: Deploy Tyk Stack and dependencies
id: deploy-stack
run: |
kubectl create namespace ${{ env.TYK_STACK_NS }}
# Do not change the name
# Install redis
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }} --version 19.0.2
# Install mongo
helm install mongo mongodb --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }} --version 15.1.2
MONGODB_ROOT_PASSWORD=$(kubectl get secret -n ${{ env.TYK_STACK_NS }} mongo-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 -d)
helm dependency update ./tyk-stack
helm install --namespace ${{ env.TYK_STACK_NS }} tyk-stack ./tyk-stack \
--set "global.mongo.mongoURL=mongodb://root:$MONGODB_ROOT_PASSWORD@mongo-mongodb.${{ env.TYK_STACK_NS }}.svc:27017/tyk_analytics?authSource=admin" \
--set "global.redis.addrs={redis-master.${{ env.TYK_STACK_NS }}.svc:6379"} \
--set "global.redis.passSecret.name=redis" \
--set "global.redis.passSecret.keyName=redis-password" \
--set "global.license.dashboard=${{ secrets.DASH_LICENSE }}" \
--set "global.storageType=mongo" \
--timeout=${{ env.TIMEOUT }}
- name: Run integration tests for Tyk Stack
id: test-stack
run: helm test -n ${{ env.TYK_STACK_NS }} tyk-stack
- if: failure()
name: Check logs in case of failure
run: |
if [ ${{ steps.deploy-stack.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env.TYK_STACK_NS }} deployment/dashboard-tyk-stack-tyk-dashboard
kubectl logs -n ${{ env.TYK_STACK_NS }} job.batch/bootstrap-post-install-tyk-stack-tyk-bootstrap
elif [ ${{ steps.test-stack.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env.TYK_STACK_NS }} tyk-stack-test-tyk-stack
fi
- name: Uninstall Tyk Stack Dependencies
run: |
helm uninstall redis -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
helm uninstall mongo -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
helm uninstall tyk-stack -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_STACK_NS }}
- name: Deploy Tyk Data Plane and Dependencies
id: deploy-data-plane
run: |
kubectl create namespace ${{ env. TYK_DATAPLANE_NS }}
# Do not change the name
helm install redis redis --wait --repo 'https://charts.bitnami.com/bitnami' -n ${{ env.TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }} --version 19.0.2
helm dependency update ./tyk-data-plane
helm install --namespace ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --wait \
--set "global.redis.addrs={redis-master.${{ env. TYK_DATAPLANE_NS }}.svc:6379"} \
--set "global.redis.passSecret.name=redis" \
--set "global.redis.passSecret.keyName=redis-password" \
--set global.remoteControlPlane.orgId=${{ secrets.HYBRID_RPC_KEY }} \
--set global.remoteControlPlane.userApiKey=${{ secrets.HYBRID_API_KEY }} \
--set global.remoteControlPlane.connectionString=${{ secrets.HYBRID_MDCB_HOST }}
- name: Run integration tests for Tyk Data Plane
id: test-data-plane
run: helm test -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane
- if: failure()
name: Check logs in case of failure
run: |
if [ ${{ steps.deploy-data-plane.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env. TYK_DATAPLANE_NS }} deployment/gateway-tyk-data-plane-tyk-gateway
elif [ ${{ steps.test-data-plane.conclusion }} == 'failure' ]; then
kubectl logs -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane-test-tyk-data-plane
fi
- name: Uninstall Tyk Data Plane Dependencies
run: |
helm uninstall tyk-data-plane -n ${{ env. TYK_DATAPLANE_NS }}
helm uninstall redis -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env. TYK_DATAPLANE_NS }}