forked from pangeo-data/pangeo-cloud-federation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_tests.sh
executable file
·32 lines (24 loc) · 1.19 KB
/
run_tests.sh
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
#!/usr/bin/env bash
export TOKEN=${JUPYTERHUB_TOKEN_GCP_USCENTRAL1B_STAGING}
if [[ ${CIRCLE_BRANCH} == "staging" ]]; then
export JUPYTERHUB_URL="https://staging.us-central1-b.gcp.pangeo.io"
else
export JUPYTERHUB_URL="https://us-central1-b.gcp.pangeo.io"
fi
curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubectl"
chmod +x kubectl
# Start a server
echo "[Staring singleuser server]"
curl -X POST -H "Authorization: token ${TOKEN}" ${JUPYTERHUB_URL}/hub/api/users/pangeo-bot/server
while [[ $(./kubectl -n ${CIRCLE_BRANCH} get pods jupyter-pangeo-2dbot -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for pod" && sleep 1; done
# Copy the test file
./kubectl -n ${CIRCLE_BRANCH} cp test.py jupyter-pangeo-2dbot:/tmp/test.py
./kubectl -n ${CIRCLE_BRANCH} cp pytest.ini jupyter-pangeo-2dbot:/tmp/pytest.ini
# Run the tests
echo "[Running tests]"
./kubectl -n staging exec jupyter-pangeo-2dbot -- /srv/conda/envs/notebook/bin/pytest -v -m "common or gcp" /tmp/test.py
RET=$?
echo "[Cleaning up]"
# Cleanup
curl -X DELETE -H "Authorization: token ${TOKEN}" "${JUPYTERHUB_URL}/hub/api/users/pangeo-bot/server"
exit $RET