Skip to content

Commit 8a41c3d

Browse files
committed
feat: makefile for test harnesses
1 parent d9e2dd1 commit 8a41c3d

4 files changed

Lines changed: 23 additions & 19 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ jobs:
3333

3434
- run: go generate -x
3535
- run: go build -v .
36-
37-
- name: Setup integration test environment
38-
run: sudo bash tests/setup.sh
39-
40-
- run: PEERINGDB_API_KEY=${{ secrets.PEERINGDB_API_KEY }} go test -race -coverprofile=coverage.txt -covermode=atomic ./pkg/... ./cmd/...
36+
- run: make test-setup
37+
- run: PEERINGDB_API_KEY=${{ secrets.PEERINGDB_API_KEY }} make test
4138

4239
- name: Upload coverage report
4340
uses: codecov/codecov-action@v1
4441
with:
4542
token: ${{ secrets.CODECOV_TOKEN }}
4643
file: ./coverage.txt
44+
45+
- run: make test-teardown

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ vendorbuild/mikrotik/docker-buildx
2626

2727
# Testing
2828
test-cache/
29-
test-conf.yml
29+
test-conf.yml
30+
nohup.out

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1+
dummy-iface:
2+
# Allow UDP ping. For more information, see https://github.com/go-ping/ping#linux
3+
sudo sysctl -w net.ipv4.ping_group_range="0 2147483647"
14

5+
sudo ip link del dev dummy0
6+
sudo ip link add dev dummy0 type dummy
7+
sudo ip addr add dev dummy0 192.0.2.1/24
8+
sudo ip link set dev dummy0 up
29

310
peeringdb-test-harness:
4-
python3 tests/peeringdb/peeringdb-test-api.py
11+
nohup python3 tests/peeringdb/peeringdb-test-api.py &
12+
13+
test-setup: dummy-iface peeringdb-test-harness
14+
15+
test:
16+
go test -race -coverprofile=coverage.txt -covermode=atomic ./pkg/... ./cmd/...
17+
18+
test-teardown:
19+
pkill -f tests/peeringdb/peeringdb-test-api.py
20+
sudo ip link del dev dummy0

tests/setup.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)