@@ -54,11 +54,11 @@ jobs:
54
54
cfg=`echo "$test" | sed 's/\.py$/.conf/'`
55
55
python -m scrapyd_k8s -c scrapyd_k8s.sample-docker.conf -c "$cfg" &
56
56
# wait for scrapyd-k8s to become ready
57
- sleep 1; curl -- retry 20 --retry-delay 2 --retry-all-errors http://localhost:6800/daemonstatus.json
57
+ curl -s -- retry 30 --retry-delay 1 --retry-all-errors http://localhost:6800/daemonstatus.json
58
58
# run test
59
59
pytest -vv --color=yes "$test"
60
60
# stop scrapyd-k8s again
61
- kill %1
61
+ kill %1; wait %1 || true
62
62
done
63
63
64
64
test-manifest :
@@ -135,19 +135,28 @@ jobs:
135
135
# run scrapyd-k8s with test-specific configuration file
136
136
cfg=`echo "$test" | sed 's/\.py$/.conf/'`
137
137
kubectl create cm scrapyd-k8s-testcfg --from-file=scrapyd_k8s.test.conf="$cfg"
138
+ echo "** before scaleup"
138
139
kubectl scale --replicas=1 deploy/scrapyd-k8s
140
+ sleep 1; echo "** after scaleup 1s"; kubectl describe pod # debug
141
+ sleep 4; echo "** after scaleup 5s"; kubectl describe pod # debug
139
142
# wait for scrapyd-k8s to become ready
140
143
kubectl wait --for=condition=Available deploy/scrapyd-k8s --timeout=60s
141
- curl --retry 10 --retry-delay 2 --retry-all-errors `minikube service scrapyd-k8s --url`/daemonstatus.json
144
+ echo "** after scaleup wait"
145
+ curl -s --retry 10 --retry-delay 2 --retry-all-errors `minikube service scrapyd-k8s --url`/daemonstatus.json
142
146
# run test
143
147
TEST_WITH_K8S=1 \
144
148
TEST_BASE_URL=`minikube service scrapyd-k8s --url` \
145
149
TEST_MAX_WAIT=60 \
146
150
TEST_AVAILABLE_VERSIONS=latest,`skopeo list-tags docker://ghcr.io/q-m/scrapyd-k8s-spider-example | jq -r '.Tags | map(select(. != "latest" and (startswith("sha-") | not))) | join(",")'` \
147
151
pytest -vv --color=yes "$test"
148
152
# stop scrapyd-k8s and delete test-specific configmap
153
+ echo "** before scaledown"
149
154
kubectl scale --replicas=0 deploy/scrapyd-k8s
150
- kubectl delete cm scrapyd-k8s-testcfg
155
+ sleep 1; echo "** after scaledown 1s"; kubectl describe pod # debug
156
+ sleep 4; echo "** after scaledown 5s"; kubectl describe pod # debug
157
+ kubectl wait --for=delete pod -l app.kubernetes.io/name=scrapyd-k8s --timeout=90s
158
+ echo "** after scaledown wait"
159
+ kubectl delete cm scrapyd-k8s-testcfg --wait
151
160
done
152
161
153
162
test-k8s :
@@ -181,18 +190,18 @@ jobs:
181
190
- name : Run tests
182
191
run : |
183
192
for test in scrapyd_k8s/tests/integration/test_*.py; do
184
- echo; echo "# $test"
193
+ echo "# $test"
185
194
# run scrapyd-k8s with test-specific configuration file
186
195
cfg=`echo "$test" | sed 's/\.py$/.conf/'`
187
196
[ -e "$cfg" ] || cfg=/dev/null
188
197
python -m scrapyd_k8s -c scrapyd_k8s.sample-k8s.conf -c "$cfg" &
189
198
# wait for scrapyd-k8s to become ready
190
- sleep 1; curl -- retry 20 --retry-delay 2 --retry-all-errors http://localhost:6800/daemonstatus.json
199
+ curl -s -- retry 30 --retry-delay 1 --retry-all-errors http://localhost:6800/daemonstatus.json
191
200
# run test
192
201
TEST_WITH_K8S=1 \
193
202
TEST_MAX_WAIT=60 \
194
203
TEST_AVAILABLE_VERSIONS=latest,`skopeo list-tags docker://ghcr.io/q-m/scrapyd-k8s-spider-example | jq -r '.Tags | map(select(. != "latest" and (startswith("sha-") | not))) | join(",")'` \
195
204
pytest -vv --color=yes "$test"
196
205
# stop scrapyd-k8s again
197
- kill %1
206
+ kill %1; wait %1 || true
198
207
done
0 commit comments