Skip to content

Commit de0c63f

Browse files
committed
Move environment to test invocation (also solves resolving scrapyd-k8s url)
1 parent 78b765c commit de0c63f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

.github/workflows/test.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ jobs:
129129
- name: Run tests
130130
run: |
131131
# setup for in-cluster k8s
132-
TEST_WITH_K8S=1
133-
TEST_BASE_URL=`minikube service scrapyd-k8s --url`
134-
TEST_MAX_WAIT=60
135-
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(",")'`
136132
# for each integration test file
137133
for test in scrapyd_k8s/tests/integration/test_*.py; do
138134
echo; echo "# $test"
@@ -144,7 +140,11 @@ jobs:
144140
kubectl wait --for=condition=Available deploy/scrapyd-k8s --timeout=60s
145141
curl --retry 10 --retry-delay 2 --retry-all-errors `minikube service scrapyd-k8s --url`/daemonstatus.json
146142
# run test
147-
pytest -vv --color=yes "$test"
143+
TEST_WITH_K8S=1 \
144+
TEST_BASE_URL=`minikube service scrapyd-k8s --url` \
145+
TEST_MAX_WAIT=60 \
146+
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+
pytest -vv --color=yes "$test"
148148
# stop scrapyd-k8s and delete test-specific configmap
149149
kubectl scale --replicas=0 deploy/scrapyd-k8s
150150
kubectl delete cm scrapyd-k8s-testcfg
@@ -180,9 +180,6 @@ jobs:
180180
181181
- name: Run tests
182182
run: |
183-
TEST_WITH_K8S=1
184-
TEST_MAX_WAIT=60
185-
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(",")'`
186183
for test in scrapyd_k8s/tests/integration/test_*.py; do
187184
echo; echo "# $test"
188185
# run scrapyd-k8s with test-specific configuration file
@@ -192,7 +189,10 @@ jobs:
192189
# wait for scrapyd-k8s to become ready
193190
sleep 1; curl --retry 20 --retry-delay 2 --retry-all-errors http://localhost:6800/daemonstatus.json
194191
# run test
195-
pytest -vv --color=yes "$test"
192+
TEST_WITH_K8S=1 \
193+
TEST_MAX_WAIT=60 \
194+
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+
pytest -vv --color=yes "$test"
196196
# stop scrapyd-k8s again
197197
kill %1
198198
done

0 commit comments

Comments
 (0)