Skip to content

Commit

Permalink
only try tests once
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam0Brien committed Nov 22, 2024
1 parent c78edef commit 5bde61e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 63 deletions.
40 changes: 4 additions & 36 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,23 @@ jobs:
- name: Inventory Up - Kind Cluster
run: make inventory-up-kind

- name: Monitor Pods in Kind
run: |
for i in {1..100}; do
MIGRATE_STATUS=$(kubectl get pods -l job-name=spicedb-cr-migrate -o jsonpath='{.status.containerStatuses[0].ready}')
if [ "$MIGRATE_STATUS" = "Completed" ]; then
echo "SpiceDB migration completed."
break
elif [ "$MIGRATE_STATUS" = "Failed" ]; then
echo "SpiceDB migration failed."
exit 1
fi
sleep 1
done
for i in {1..100}; do
ZK_STATUS=$(kubectl get pods my-cluster-zookeeper-0 -o jsonpath='{.status.phase}')
ZK_READY=$(kubectl get pods my-cluster-zookeeper-0 -o jsonpath='{.status.containerStatuses[0].ready}')
if [ "$ZK_STATUS" = "Running" ] && [ "$ZK_READY" = "true" ]; then
echo "Zookeeper is running and ready."
exit 0
else
echo "Zookeeper is not ready yet. Status: $ZK_STATUS, Ready: $ZK_READY"
fi
sleep 1
done
echo "Timeout reached while waiting for Zookeeper to be ready."
exit 1

- name: View Test Pod Logs
run: |
for i in {1..300}; do
for i in {1..50}; do
STATUS=$(kubectl get pods --selector=job-name=e2e-inventory-http-tests -o jsonpath='{.items[0].status.containerStatuses[0].state.terminated.reason}')
TEST_POD=$(kubectl get pods --selector=job-name=e2e-inventory-http-tests -o jsonpath='{.items[0].metadata.name}')
if [ "$STATUS" = "Completed" ]; then
echo "Test pod completed successfully."
echo "E2E test pod completed successfully."
kubectl logs $TEST_POD
kubectl get pods
exit 0
elif [ "$STATUS" = "Error" ]; then
echo "Test pod failed."
echo "E2E test pod failed."
kubectl logs $TEST_POD
kubectl get pods
exit 1
fi
sleep 1
sleep 3
done
Expand Down
4 changes: 3 additions & 1 deletion deploy/kind/e2e/e2e-batch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: e2e-inventory-http-tests
spec:
completions: 1
backoffLimit: 0
template:
spec:
initContainers:
Expand All @@ -19,6 +20,8 @@ spec:
sleep 5
done
echo "Inventory service is ready!"
containers:
- name: e2e-http-tests
image: localhost/inventory-e2e-tests:e2e-test
Expand All @@ -29,4 +32,3 @@ spec:
value: "localhost:9092"
command: ["/usr/local/bin/e2e-inventory-tests", "-test.v"]
restartPolicy: Never
backoffLimit: 4
5 changes: 0 additions & 5 deletions deploy/kind/relations/spicedb-kind-setup/kind-kube/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions deploy/kind/relations/spicedb-kind-setup/postgres/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/kind/relations/spicedb-kind-setup/spicedb-cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
logLevel: debug
datastoreEngine: postgres
#datastoreTLSSecretName: datastore-tls
replicas: 2
replicas: 1
secretName: spicedb-config

---
Expand Down
31 changes: 16 additions & 15 deletions scripts/start-inventory-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,8 @@ ${DOCKER} save -o inventory-e2e-tests.tar localhost/inventory-e2e-tests:e2e-test
kind load image-archive inventory-api.tar --name inventory-cluster
kind load image-archive inventory-e2e-tests.tar --name inventory-cluster

#kubectl create configmap inventory-api-psks --from-file=config/psks.yaml
#
#kubectl apply -f https://strimzi.io/install/latest\?namespace\=default
#kubectl apply -f deploy/kind/inventory/kessel-inventory.yaml
#kubectl apply -f deploy/kind/inventory/invdatabase.yaml
#kubectl apply -f deploy/kind/e2e/e2e-batch.yaml
#kubectl apply -f deploy/kind/inventory/strimzi.yaml

# Create the kessel namespace
kubectl create namespace kessel

# Deploy ConfigMap for inventory-api
kubectl create configmap inventory-api-psks --from-file=config/psks.yaml

# Deploy Inventory dependencies
kubectl apply -f https://strimzi.io/install/latest\?namespace\=default
kubectl apply -f deploy/kind/inventory/kessel-inventory.yaml
kubectl apply -f deploy/kind/inventory/invdatabase.yaml
Expand All @@ -45,10 +32,9 @@ kubectl apply -f deploy/kind/inventory/strimzi.yaml
kubectl apply -f https://projectcontour.io/quickstart/contour.yaml
kubectl get crd httpproxies.projectcontour.io

# add configmap
# add configmap for spicedb schema
kubectl create configmap spicedb-schema --from-file=deploy/schema.zed

# Deploy SpiceDB and Relations-API in the kessel namespace
kubectl apply -f deploy/kind/relations/spicedb-kind-setup/postgres/secret.yaml
kubectl apply -f deploy/kind/relations/spicedb-kind-setup/postgres/postgresql.yaml
kubectl apply -f deploy/kind/relations/spicedb-kind-setup/postgres/storage.yaml
Expand All @@ -59,5 +45,20 @@ kubectl apply -f deploy/kind/relations/spicedb-kind-setup/relations-api/secret.y
kubectl apply -f deploy/kind/relations/spicedb-kind-setup/relations-api/deployment.yaml
kubectl apply -f deploy/kind/relations/spicedb-kind-setup/relations-api/svc.yaml



echo "Waiting for all pods to be fully ready..."
while true; do
PODS_READY=$(kubectl get pods --no-headers | awk '{print $2}' | grep -v '^1/1$' | wc -l)
if [ "$PODS_READY" -eq 0 ]; then
echo "All pods are ready!"
break
else
echo "Waiting for pods to be ready... ($PODS_READY not ready yet)"
sleep 5
fi
done

kubectl apply -f deploy/kind/e2e/e2e-batch.yaml

echo "Setup complete."

0 comments on commit 5bde61e

Please sign in to comment.