Skip to content

chore: update error messages in shutdown tests for clarity #65

chore: update error messages in shutdown tests for clarity

chore: update error messages in shutdown tests for clarity #65

Workflow file for this run

name: Tests
on: [push]
permissions:
contents: read
jobs:
go:
# TODO: Split go tests into multiple jobs to reduce the time
# e.g. go-unit, go-e2e
name: Go - Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install dependencies
run: |
go install github.com/mfridman/tparse@latest
go mod download
- name: Run all go tests
run: |
go test -v -count=1 -race ./... -json -coverpkg ./... \
| tee output.jsonl | tparse -notests -follow -all || true
tparse -format markdown -file output.jsonl -all -slow 20 > $GITHUB_STEP_SUMMARY
traceroute:
name: E2E - Traceroute
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
sudo add-apt-repository ppa:katharaframework/kathara
sudo apt-get update
sudo apt-get install -y jq kathara
- name: Setup kathara
run: |
echo '{
"image": "kathara/base",
"manager_type": "docker",
"terminal": "/usr/bin/xterm",
"open_terminals": false,
"device_shell": "/bin/bash",
"net_prefix": "kathara",
"device_prefix": "kathara",
"debug_level": "INFO",
"print_startup_log": true,
"enable_ipv6": false,
"last_checked": 1721834897.2415252,
"hosthome_mount": false,
"shared_mount": true,
"image_update_policy": "Prompt",
"shared_cds": 1,
"remote_url": null,
"cert_path": null,
"network_plugin": "kathara/katharanp_vde"
}' > ~/.config/kathara.conf
- name: Build binary for e2e
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: build --single-target --clean --snapshot --config .goreleaser-ci.yaml
- name: Run e2e tests
run: |
./scripts/run_e2e_tests.sh
k8s:
name: E2E - Kubernetes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up K3S
uses: debianmaster/actions-k3s@master
id: k3s
with:
version: "v1.31.2-k3s1"
- name: Check Cluster
run: kubectl get nodes
- name: Check Coredns Deployment
run: |
kubectl -n kube-system rollout status deployment/coredns --timeout=60s
STATUS=$(kubectl -n kube-system get deployment coredns -o jsonpath={.status.readyReplicas})
if [[ $STATUS -ne 1 ]]
then
echo "Deployment coredns not ready"
kubectl -n kube-system get events
exit 1
else
echo "Deployment coredns OK"
fi
- name: Check Metricsserver Deployment
run: |
kubectl -n kube-system rollout status deployment/metrics-server --timeout=60s
STATUS=$(kubectl -n kube-system get deployment metrics-server -o jsonpath={.status.readyReplicas})
if [[ $STATUS -ne 1 ]]
then
echo "Deployment metrics-server not ready"
kubectl -n kube-system get events
exit 1
else
echo "Deployment metrics-server OK"
fi
- name: Setup Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm version
- name: Get Image Tag
id: version
run: echo "value=commit-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Install Sparrow
run: |
helm upgrade -i sparrow \
--atomic \
--timeout 300s \
--set image.tag=${{ steps.version.outputs.value }} \
--set sparrowConfig.name=the-sparrow.com \
--set sparrowConfig.loader.type=file \
--set sparrowConfig.loader.interval=5s \
--set sparrowConfig.loader.file.path=/config/.sparrow.yaml \
--set checksConfig.health.interval=1s \
--set checksConfig.health.timeout=1s \
./chart
- name: Check Pods
run: kubectl get pods
- name: Wait for Sparrow
run: sleep 45
- name: Healthcheck
run: |
kubectl create job curl --image=quay.io/curl/curl:latest -- curl -f -v -H 'Content-Type: application/json' http://sparrow:8080/v1/metrics/health
kubectl wait --for=condition=complete job/curl
STATUS=$(kubectl get job curl -o jsonpath={.status.succeeded})
if [[ $STATUS -ne 1 ]]
then
echo "Job failed"
kubectl logs -ljob-name=curl
kubectl delete job curl
exit 1
else
echo "Job OK"
kubectl delete job curl
fi