-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (55 loc) · 2.07 KB
/
endtoend_test_final.yml
File metadata and controls
68 lines (55 loc) · 2.07 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: End-to-End Test Final
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: waltermity/demohttpserver:latest
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Create k8s Kind Cluster
uses: waltermity/kind-action@test_sha256
with:
config: kind-config.yaml
cloud_provider: true
- name: Apply manifests
run: |
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
- name: Wait for LoadBalancer to get external IP
run: |
echo "Waiting for external IP (timeout: 120s)..."
timeout 120s bash -c 'until kubectl get service demo-http-server-service -o jsonpath="{.status.loadBalancer.ingress[0].ip}" | grep -v "null"; do sleep 2; done' || true
EXTERNAL_IP=$(kubectl get service demo-http-server-service -o jsonpath="{.status.loadBalancer.ingress[0].ip}")
if [ -z "$EXTERNAL_IP" ]; then
echo "Failed to get external IP, test will likely fail"
else
echo "Service has external IP: $EXTERNAL_IP"
echo "SERVICE_URL=http://${EXTERNAL_IP}:5000" >> $GITHUB_ENV
fi
- name: Send GET request and check response
run: |
response=$(curl -v ${{ env.SERVICE_URL }})
echo "Response: $response"
if [ "$response" == "Hello there!" ]; then
echo "✅ The value received is correct"
else
echo "❌ Received value is incorrect"
exit 1
fi