added smoke tests workflow
This commit is contained in:
parent
53f2528094
commit
e5e2364b48
1 changed files with 104 additions and 0 deletions
104
.github/workflows/smoke-tests.yml
vendored
Normal file
104
.github/workflows/smoke-tests.yml
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
name: "System Smoke Tests"
|
||||
on:
|
||||
push:
|
||||
# run on pushes to master or release/*
|
||||
branches:
|
||||
- master
|
||||
- release/*
|
||||
pull_request:
|
||||
# run on pull requests targeting master
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
setup:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Check Test Cluster
|
||||
run: |
|
||||
if kubectl get nodes; then
|
||||
kubectl get nodes
|
||||
else
|
||||
echo "test cluster not active. Attempting to create through kind..."
|
||||
kind create cluster
|
||||
kubectl get nodes
|
||||
fi
|
||||
test-source:
|
||||
runs-on: self-hosted
|
||||
needs: setup
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clean Cluster
|
||||
run: |
|
||||
kubectl delete all --all --wait=true --force --grace-period=0
|
||||
sleep 5
|
||||
- name: Deploy From Source
|
||||
run: |
|
||||
skaffold run
|
||||
- name: Wait For Pods
|
||||
run: |
|
||||
sleep 60
|
||||
kubectl get pods
|
||||
echo waiting for ready state...
|
||||
kubectl wait --for=condition=ready pod -l app=adservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=cartservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=checkoutservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=currencyservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=emailservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=frontend --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=loadgenerator --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=paymentservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=productcatalogservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=recommendationservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=shippingservice --timeout=500s
|
||||
- name: Test HTTP
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
RESULT=" "
|
||||
while [[ "$RESULT" != " HTTP/1.1 200 OK" ]]; do
|
||||
sleep 1
|
||||
RESULT=$(kubectl exec deployments/frontend -- sh -c "wget --spider -S "http://frontend" 2>&1 | grep 'HTTP/'")
|
||||
echo "front end response: $RESULT"
|
||||
done
|
||||
if [[ "$RESULT" != " HTTP/1.1 200 OK" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
test-release:
|
||||
runs-on: self-hosted
|
||||
needs: [setup, test-source]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clean Cluster
|
||||
run: |
|
||||
kubectl delete all --all --wait=true --force --grace-period=0
|
||||
sleep 5
|
||||
- name: Deploy Release Manifests
|
||||
run: |
|
||||
kubectl apply -f ./release/kubernetes-manifests.yaml
|
||||
- name: Wait For Pods
|
||||
run: |
|
||||
sleep 60
|
||||
kubectl get pods
|
||||
echo waiting for ready state...
|
||||
kubectl wait --for=condition=ready pod -l app=adservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=cartservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=checkoutservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=currencyservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=emailservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=frontend --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=loadgenerator --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=paymentservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=productcatalogservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=recommendationservice --timeout=500s
|
||||
kubectl wait --for=condition=ready pod -l app=shippingservice --timeout=500s
|
||||
- name: Test HTTP
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
RESULT=" "
|
||||
while [[ "$RESULT" != " HTTP/1.1 200 OK" ]]; do
|
||||
sleep 1
|
||||
RESULT=$(kubectl exec deployments/frontend -- sh -c "wget --spider -S "http://frontend" 2>&1 | grep 'HTTP/'")
|
||||
echo "front end response: $RESULT"
|
||||
done
|
||||
if [[ "$RESULT" != " HTTP/1.1 200 OK" ]]; then
|
||||
exit 1
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue