@@ -60,10 +60,13 @@ jobs:
60
60
docker logs statista_proxy
61
61
62
62
- name : Test Docker Image with Cookie Strategy without cookie
63
+ id : test-cookie-no-cookie
64
+ continue-on-error : true
63
65
run : |
64
66
curl -Is localhost:80 | grep -i -e "x-proxy-flow: route-to-legacy"
65
67
66
68
- name : Test Docker Image with Cookie Strategy with cookie
69
+ continue-on-error : true
67
70
run : |
68
71
curl -Is --cookie "my_app_routing=new" localhost:80 | grep -i -e "x-proxy-flow: route-to-new"
69
72
@@ -86,18 +89,26 @@ jobs:
86
89
docker logs statista_proxy
87
90
88
91
- name : Test Docker Image with Percentage Strategy backend selection
92
+ id : test-percentage-strategy
93
+ continue-on-error : true
89
94
run : |
90
95
curl -Is localhost:80 | grep -i -e "x-proxy-flow: route-to-percentage"
91
96
92
97
- name : Test Docker Image with Percentage Strategy with sticky cookie on old domain
98
+ id : test-percentage-sticky-old-domain
99
+ continue-on-error : true
93
100
run : |
94
101
curl -Is localhost:80 --cookie "my_app=old_domain" | grep -i -e "server: Apache"
95
102
96
103
- name : Test Docker Image with Percentage Strategy with sticky cookie on new domain
104
+ id : test-percentage-sticky-new-domain
105
+ continue-on-error : true
97
106
run : |
98
107
curl -Is localhost:80 --cookie "my_app=new_domain" | grep -i -e "x-served-by: cache-"
99
108
100
109
- name : Test Docker Image with Percentage Strategy with round robin
110
+ id : test-percentage-round-robin
111
+ continue-on-error : true
101
112
# sadly we dont know which server serves us first, so we have to check both
102
113
run : |
103
114
curl -Is localhost:80 | grep -i -e "server:" -e "x-served-by:" -e "set-cookie: my_app=new_domain; path=/" -e "set-cookie: my_app=old_domain; path=/"
@@ -107,53 +118,91 @@ jobs:
107
118
if : success() || failure()
108
119
run : docker rm -f statista_proxy
109
120
121
+ # validation TEMPLATE
122
+ # - name: name of the test
123
+ # timeout-minutes: 1 # set so if the command runs successfully the test will fail
124
+ # id: test-validation-percentage-new # important since all steps run and we collect the failure at then end
125
+ # continue-on-error: true # important for allowing other steps to be run regardless of this one which might fail
126
+ # run: |
127
+ # ! docker run \ # important simply negate the exit code, since we expect the container to fail (which means succesfull validation)
128
+ # -e OLD_DOMAIN=haproxy.com:443 -e NEW_DOMAIN=apache.org:443 \
129
+ # "${{ env.IMAGE_NAME }}"
130
+
110
131
# variable validation
111
132
- name : Run Docker Image with Invalid new Percentage
133
+ timeout-minutes : 1
134
+ id : test-validation-percentage-new
135
+ continue-on-error : true
112
136
run : |
113
- set +e
114
-
115
- docker run \
137
+ ! docker run \
116
138
-e STRATEGY=PERCENTAGE \
117
139
-e OLD_DOMAIN=haproxy.com:443 -e NEW_DOMAIN=apache.org:443 \
118
140
-e PERCENTAGE_NEW=foo -e PERCENTAGE_OLD=50 \
119
141
-e COOKIE_PERCENTAGE_NAME=my_app \
120
142
"${{ env.IMAGE_NAME }}"
121
143
122
- if [[ $? == 1 ]]; then exit 0; else exit 1; fi
123
-
124
144
- name : Run Docker Image with Invalid old Percentage
145
+ timeout-minutes : 1
146
+ id : test-validation-percentage-old
147
+ continue-on-error : true
125
148
run : |
126
- set +e
127
-
128
- docker run \
149
+ ! docker run \
129
150
-e STRATEGY=PERCENTAGE \
130
151
-e OLD_DOMAIN=haproxy.com:443 -e NEW_DOMAIN=apache.org:443 \
131
152
-e PERCENTAGE_NEW=50 -e PERCENTAGE_OLD=foo \
132
153
-e COOKIE_PERCENTAGE_NAME=my_app \
133
154
"${{ env.IMAGE_NAME }}"
134
155
135
- if [[ $? == 1 ]]; then exit 0; else exit 1; fi
136
-
137
156
- name : Run Docker Image with Invalid old domain
157
+ timeout-minutes : 1
158
+ id : test-validation-old-domain
159
+ continue-on-error : true
138
160
run : |
139
- set +e
140
-
141
- docker run \
161
+ ! docker run \
142
162
-e STRATEGY=PERCENTAGE \
143
163
-e NEW_DOMAIN=apache.org:443 \
144
164
-e COOKIE_PERCENTAGE_NAME=my_app \
145
165
"${{ env.IMAGE_NAME }}"
146
166
147
- if [[ $? == 1 ]]; then exit 0; else exit 1; fi
148
-
149
167
- name : Run Docker Image with Invalid new domain
168
+ timeout-minutes : 1
169
+ id : test-validation-new-domain
170
+ continue-on-error : true
150
171
run : |
151
- set +e
152
-
153
- docker run \
172
+ ! docker run \
154
173
-e STRATEGY=PERCENTAGE \
155
174
-e OLD_DOMAIN=haproxy.com:443 -e NEW_DOMAIN=apache.org:lol \
156
175
-e COOKIE_PERCENTAGE_NAME=my_app \
157
176
"${{ env.IMAGE_NAME }}"
158
177
159
- if [[ $? == 1 ]]; then exit 0; else exit 1; fi
178
+ - name : Run Docker Image with Invalid server count
179
+ timeout-minutes : 1
180
+ id : test-validation-server-count
181
+ continue-on-error : true
182
+ run : |
183
+ ! docker run \
184
+ -e STRATEGY=PERCENTAGE \
185
+ -e OLD_DOMAIN=haproxy.com:443 -e NEW_DOMAIN=apache.org:443 \
186
+ -e COOKIE_PERCENTAGE_NAME=my_app \
187
+ -e SERVER_COUNT=foo \
188
+ "${{ env.IMAGE_NAME }}"
189
+
190
+ - name : Run Docker Image with Invalid DNS Resolver
191
+ timeout-minutes : 1
192
+ id : test-validation-dns-resolver
193
+ continue-on-error : true
194
+ run : |
195
+ ! docker run \
196
+ -e STRATEGY=PERCENTAGE \
197
+ -e OLD_DOMAIN=haproxy.com:443 -e NEW_DOMAIN=apache.org:443 \
198
+ -e COOKIE_PERCENTAGE_NAME=my_app \
199
+ -e DNS_RESOLVER=foo \
200
+ "${{ env.IMAGE_NAME }}"
201
+
202
+ - name : Check for failures
203
+ if : always()
204
+ env :
205
+ STEPS_CONTEXT : ${{ toJson(steps) }}
206
+ run : |
207
+ set +e
208
+ ! echo "$STEPS_CONTEXT" | grep -q 'failure'
0 commit comments