-
Notifications
You must be signed in to change notification settings - Fork 11
69 lines (64 loc) · 2.08 KB
/
integration.yaml
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
69
name: Integration Tests
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
types: [opened, reopened, synchronize]
jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: tests
run: |
check_service_health() {
local health_url="$1"
local start_time=$(date +%s)
while : ; do
if curl -s --fail "$health_url" > /dev/null; then
echo "Service is up!"
return 0
fi
local current_time=$(date +%s)
if (( current_time - start_time >= 5 )); then
echo "Timed out waiting for service to be up."
return 1
fi
sleep 0.2
done
}
echo "stop/disable/kill mono"
sudo systemctl stop mono-xsp4.service || true
sudo systemctl disable mono-xsp4.service || true
sudo pkill mono || true
echo "change to weather example directory"
cd example/weather
echo "run setup script"
./scripts/setup
echo "run server"
./bin/forecaster &
./bin/locator &
./bin/tester &
./bin/front &
check_service_health "http://localhost:8081/healthz" &
check_service_health "http://localhost:8083/healthz" &
check_service_health "http://localhost:8091/healthz" &
check_service_health "http://localhost:8085/healthz" &
wait -n
echo "-----RUN TESTS-----"
results=$(curl -X POST http://localhost:8084/tester/smoke)
echo "-----RESULTS-----"
echo $results
echo "----------"
if [ $(echo $results | jq '.fail_count') -gt 0 ];
then
echo "Test errors found."
exit 1
else
echo "Tests passed."
exit 0
fi