feat: CI/CD integration testing with network access #23
+10
-16
@@ -70,11 +70,9 @@ jobs:
|
|||||||
KUBECONFIG_B64: ${{ secrets.KUBECONFIG_B64 }}
|
KUBECONFIG_B64: ${{ secrets.KUBECONFIG_B64 }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Install kubectl
|
- name: Verify kubectl availability
|
||||||
run: |
|
run: |
|
||||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
kubectl version --client || (echo "ERROR: kubectl not available" && exit 1)
|
||||||
chmod +x kubectl
|
|
||||||
sudo mv kubectl /usr/local/bin/
|
|
||||||
|
|
||||||
- name: Deploy test pod from new image
|
- name: Deploy test pod from new image
|
||||||
run: |
|
run: |
|
||||||
@@ -91,20 +89,16 @@ jobs:
|
|||||||
kubectl wait --for=condition=ready pod -l run=api-gateway-test-${{ steps.sha.outputs.short_sha }} -n api --timeout=60s
|
kubectl wait --for=condition=ready pod -l run=api-gateway-test-${{ steps.sha.outputs.short_sha }} -n api --timeout=60s
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Run integration tests against test pod
|
- name: Run integration tests inside test pod
|
||||||
run: |
|
run: |
|
||||||
echo "Running integration tests against test pod..."
|
echo "Running integration tests inside test pod..."
|
||||||
# Port-forward to test pod
|
echo "Test pod: api-gateway-test-${{ steps.sha.outputs.short_sha }}"
|
||||||
kubectl port-forward -n api pod/api-gateway-test-${{ steps.sha.outputs.short_sha }} 8080:8080 &
|
sleep 5
|
||||||
PF_PID=$!
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
# Run tests
|
# Run tests from inside the pod
|
||||||
TEST_RESULT=0
|
# Pod has network access to all services via network policy labels
|
||||||
go test -v -tags=integration -timeout=5m ./internal/integration/... || TEST_RESULT=$?
|
kubectl exec -n api pod/api-gateway-test-${{ steps.sha.outputs.short_sha }} -- \
|
||||||
|
go test -v -tags=integration -timeout=5m ./internal/integration/...
|
||||||
kill $PF_PID || true
|
|
||||||
exit $TEST_RESULT
|
|
||||||
env:
|
env:
|
||||||
GATEWAY_URL: http://localhost:8080
|
GATEWAY_URL: http://localhost:8080
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
|
|||||||
Reference in New Issue
Block a user