Skip to content

Commit

Permalink
ci: pass num guardians to ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray authored and tbjump committed Jun 16, 2023
1 parent 26d849b commit 0f0b15f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
12 changes: 11 additions & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ def set_replicas_in_statefulset(config_yaml, statefulset_name, num_replicas):
obj["spec"]["replicas"] = num_replicas
return config_yaml

# set the env value of all containers in all jobs
def set_env_in_jobs(config_yaml, name, value):
for obj in config_yaml:
if obj["kind"] == "Job":
for container in obj["spec"]["template"]["spec"]["containers"]:
if not "env" in container:
container["env"] = []
container["env"].append({"name": name, "value": value})
return config_yaml

allow_k8s_contexts("ci")

# Disable telemetry by default
Expand Down Expand Up @@ -615,7 +625,7 @@ if ci_tests:
],
)

k8s_yaml_with_ns("devnet/tests.yaml")
k8s_yaml_with_ns(encode_yaml_stream(set_env_in_jobs(read_yaml_stream("devnet/tests.yaml"), "NUM_GUARDIANS", str(num_guardians))))

# separate resources to parallelize docker builds
k8s_resource(
Expand Down
2 changes: 1 addition & 1 deletion devnet/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
command:
- /bin/sh
- -c
- "sh /app/testing/spydk.sh && touch /app/testing/success"
- "bash /app/testing/spydk.sh && touch /app/testing/success"
readinessProbe:
exec:
command:
Expand Down
5 changes: 3 additions & 2 deletions testing/Dockerfile.spydk.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM node:16-alpine@sha256:004dbac84fed48e20f9888a23e32fa7cf83c2995e174a78d41d9a9dd1e051a20
FROM node:19.6.1-slim@sha256:a1ba21bf0c92931d02a8416f0a54daad66cb36a85d2b73af9d73b044f5f57cfc

RUN apk update && apk add g++ make python3 curl
RUN apt-get update && apt-get -y install \
git python3 make curl netcat

RUN mkdir -p /app
WORKDIR /app
Expand Down
6 changes: 5 additions & 1 deletion testing/sdk.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/sh
set -e
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' guardian:6060/readyz)" != "200" ]]; do sleep 5; done
num=${NUM_GUARDIANS:-1} # default value for NUM_GUARDIANS = 1
for ((i=0; i<num; i++)); do
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' guardian-$i.guardian:6060/readyz)" != "200" ]]; do sleep 5; echo "waiting for guardian $i"; done
done

while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' spy:6060/metrics)" != "200" ]]; do sleep 5; done
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ibc-relayer:7597/debug/pprof/)" != "200" ]]; do sleep 5; done
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' relayer-engine:3000/metrics)" != "200" ]]; do sleep 5; done
Expand Down
5 changes: 4 additions & 1 deletion testing/spydk.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh
set -e
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' guardian:6060/readyz)" != "200" ]]; do sleep 5; done
num=${NUM_GUARDIANS:-1} # default value for NUM_GUARDIANS = 1
for ((i=0; i<num; i++)); do
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' guardian-$i.guardian:6060/readyz)" != "200" ]]; do sleep 5; done
done
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' spy:6060/metrics)" != "200" ]]; do sleep 5; done
CI=true npm --prefix ../spydk/js run test-ci
5 changes: 4 additions & 1 deletion wormchain/contracts/tools/test_accountant.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/sh
set -e
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' guardian:6060/readyz)" != "200" ]]; do sleep 5; done
num=${NUM_GUARDIANS:-1} # default value for NUM_GUARDIANS = 1
for ((i=0; i<num; i++)); do
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' guardian-$i.guardian:6060/readyz)" != "200" ]]; do sleep 5; done
done
CI=true npm run test-accountant

0 comments on commit 0f0b15f

Please sign in to comment.