-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (81 loc) · 2.73 KB
/
test-runn.yml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Test
on:
pull_request:
branches:
- main
jobs:
api-test-monolithic:
runs-on: ubuntu-latest
services:
docker:
image: docker:19.03.12
options: --privileged
steps:
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f
- uses: actions/setup-go@v4
with:
go-version: 1.22.2
- name: "Install Deps"
run: |
sudo apt-get update
go mod download
go install github.com/k1LoW/runn/cmd/runn@latest
- name: "Start Server"
run: |
go run go/cmd/open-ve/main.go run --http-port=8080 &
- name: "Health Check"
run: |
for i in {1..10}; do
STATUS=$(curl -s http://localhost:8080/healthz | jq -r .status)
if [ "$STATUS" == "SERVING" ]; then
echo "Service is healthy!"
exit 0
fi
echo "Waiting for the service to be healthy..."
sleep 5
done
echo "Service did not become healthy in time."
exit 1
- name: "Run runn"
run: |
export MONOLITHIC_ENDPOINT=http://0.0.0.0:8080
make api-test-monolithic
api-test-master-slave:
runs-on: ubuntu-latest
services:
docker:
image: docker:19.03.12
options: --privileged
steps:
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f
- uses: actions/setup-go@v4
with:
go-version: 1.22.2
- name: "Install Deps"
run: |
sudo apt-get update
go mod download
go install github.com/k1LoW/runn/cmd/runn@latest
- name: "Start Master and Slave Server"
run: |
go run go/cmd/open-ve/main.go run --mode=master --http-port=8081 --grpc-port=9001 &
go run go/cmd/open-ve/main.go run --mode=slave --slave-id=slave-node-id --slave-master-http-addr=http://localhost:8081 --slave-slave-http-addr=http://localhost:8082 --http-port=8082 --grpc-port=9002 &
- name: "Health Check"
run: |
for i in {1..10}; do
MASTER_STATUS=$(curl -s http://localhost:8081/healthz | jq -r .status)
SLAVE_STATUS=$(curl -s http://localhost:8082/healthz | jq -r .status)
if [ "$MASTER_STATUS" == "SERVING" ] && [ "$SLAVE_STATUS" == "SERVING" ]; then
echo "Service is healthy!"
exit 0
fi
echo "Waiting for the service to be healthy..."
sleep 5
done
echo "Service did not become healthy in time."
exit 1
- name: "Run runn"
run: |
export MASTER_ENDPOINT=http://0.0.0.0:8081
export SLAVE_ENDPOINT=http://0.0.0.0:8082
make api-test-master-slave