-
-
Notifications
You must be signed in to change notification settings - Fork 49
119 lines (98 loc) · 3.13 KB
/
testing-go.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: tests go
on:
push:
paths-ignore:
- 'docs/**'
- 'README.md'
branches:
- main
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
branches:
- main
permissions:
contents: read
jobs:
dev:
strategy:
matrix:
os-version: ['ubuntu-22.04', 'macos-latest' ]
go-version: [ '1.20', '1.21' ]
package: ['dnsutils', 'collectors', 'loggers', 'transformers', 'netlib', 'processors']
exclude:
- os-version: macos-latest
go-version: '1.20'
runs-on: ${{ matrix.os-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Show Go version
run: |
go version
sudo go version
- name: Set up Go for root
if: runner.os != 'macOS'
run: |
which go
sudo which go
sudo ln -sf `which go` `sudo which go` || true
- name: Show Go version
run: |
go version
sudo go version
- name: Test ${{ matrix.package }}
run: sudo go test -timeout 120s ./${{ matrix.package }}/ -race -cover -v
int:
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: ['1.20', '1.21']
package: ['config', 'clientquery_dnstaptcp', 'clientquery_dnstapunix' ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: build binary
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o go-dnscollector *.go
- name: Test ${{ matrix.package }}
run: |
sudo python3 -m pip install dnstap_pb fstrm dnspython
sudo python3 -m pip install --upgrade protobuf
sudo python3 -m unittest tests.${{ matrix.package }} -v
metrics:
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: ['1.21']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: build binary
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go
- name: run collector
run: ./go-dnscollector -config ./testsdata/config_prom.yml &
- name: download dnstap generator
run: |
wget -nv https://github.com/dmachard/go-dnstap-generator/releases/download/v${{ env.GENTAP }}/go-dnstap-generator_${{ env.GENTAP }}_linux_amd64.tar.gz
tar xf go-dnstap-generator_${{ env.GENTAP }}_linux_amd64.tar.gz
./go-dnstap-generator -i 127.0.0.1 -p 6000 -n 1
env:
GENTAP: "0.5.0"
- name: check prometheus format metrics
run: |
wget -nv https://github.com/prometheus/prometheus/releases/download/v$PROM_VERSION/prometheus-$PROM_VERSION.linux-amd64.tar.gz
tar xf prometheus-$PROM_VERSION.linux-amd64.tar.gz
cd prometheus-$PROM_VERSION.linux-amd64/
curl -u admin:changeme http://127.0.0.1:8081/metrics | ./promtool check metrics
env:
PROM_VERSION: "2.47.0"