mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-10 06:04:18 +00:00
test: add wait script/build data
This commit is contained in:
parent
fb804babeb
commit
734aa0a9ad
2 changed files with 29 additions and 2 deletions
8
.github/workflows/kustomize.yml
vendored
8
.github/workflows/kustomize.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: Create Cluster
|
||||
name: kustomize
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -21,4 +21,8 @@ jobs:
|
|||
kubectl cluster-info
|
||||
kubectl get storageclass standard
|
||||
cp Resources/k8s/kustomize/secrets/postgres.env.sample Resources/k8s/kustomize/secrets/postgres.env
|
||||
kubectl apply -k Resources/k8s/kustomize/
|
||||
make kustomize-apply
|
||||
bash Resources/scripts/wait.sh http://localhost/api/v2/
|
||||
make k8s-migrate
|
||||
make k8s-build-db
|
||||
bash Resources/scripts/wait.sh http://localhost/api/v2/pal-park-area/5/
|
||||
|
|
23
Resources/scripts/wait.sh
Normal file
23
Resources/scripts/wait.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
wait_for_http() {
|
||||
local url="$1"
|
||||
local max_seconds=1000
|
||||
local end_time=$(( $(date +%s) + max_seconds ))
|
||||
local success='false'
|
||||
echo "Waiting for $url"
|
||||
while [ "$(date +%s)" -lt "$end_time" ]; do # Loop until interval has elapsed.
|
||||
sleep 2
|
||||
if [ "$(curl -s -o /dev/null -L -w '%{http_code}' "$url")" == "200" ]; then
|
||||
success='true'
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$success" = 'true' ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_http "${1:-http://localhost/api/v2/}"
|
Loading…
Reference in a new issue