Skip to content

Commit f22439b

Browse files
authored
Merge pull request #966 from threefoldtech/development_split_tests
split integration tests and update sdk
2 parents 35f7991 + 2a7ea08 commit f22439b

38 files changed

Lines changed: 407 additions & 122 deletions

.github/workflows/terratest.yml

Lines changed: 189 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,35 @@ name: Intgeration tests
22

33
on:
44
schedule:
5-
- cron: "0 0 * * *"
5+
- cron: "0 1 * * *"
66
workflow_dispatch:
77
push:
88
tags:
99
- "v*"
1010

1111
jobs:
12-
go-tests:
13-
name: Run Go Tests
12+
test-dev:
13+
name: Testing
1414
runs-on: ubuntu-latest
1515
timeout-minutes: 0
1616
strategy:
1717
fail-fast: false
18+
max-parallel: 1
1819
matrix:
19-
network: ["dev", "qa", "test", "main"]
20+
# network: ["dev", "qa", "test", "main"]
21+
network: ["dev"]
22+
tests: [{name: "vm", test: "go test -v ./... --tags=integration -run TestVM"},
23+
{name: "k8s", test: "go test -v ./... --tags=integration -run TestK8s"},
24+
{name: "gateway", test: "go test -v ./... --tags=integration -run TestGatewayDeployments"},
25+
{name: "gateway-private", test: "go test -v ./... --tags=integration -run TestGatewayPrivate"},
26+
{name: "wireguard", test: "go test -v ./... --tags=integration -run TestWireguard"},
27+
{name: "zdb", test: "go test -v ./... --tags=integration -run TestZdbs"},
28+
{name: "qsfs", test: "go test -v ./... --tags=integration -run TestQSFS"},
29+
{name: "peertube", test: "go test -v ./... --tags=integration -run TestPeertube"},
30+
{name: "presearch", test: "go test -v ./... --tags=integration -run TestPresearch"},
31+
{name: "taiga", test: "go test -v ./... --tags=integration -run TestTaiga"},
32+
{name: "mattermost", test: "go test -v ./... --tags=integration -run TestMattermost"}]
33+
2034
steps:
2135
- uses: actions/setup-go@v5
2236
with:
@@ -41,7 +55,7 @@ jobs:
4155
PEERS=$(curl https://raw.githubusercontent.com/AhmedHanafy725/yggdrasil-config/main/config.json | jq '.yggdrasil.peers[]' -r | sed 's/\//\\\//g' | sed -z 's/\n/\\n/g')
4256
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
4357
sudo systemctl restart yggdrasil
44-
- uses: actions/checkout@v4.1.1
58+
- uses: actions/checkout@v4
4559
with:
4660
fetch-depth: 0
4761
- name: Build
@@ -50,89 +64,196 @@ jobs:
5064
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
5165
go build -o terraform-provider-grid
5266
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
53-
- name: Test virtual machines
67+
- name: Test ${{ matrix.tests.name }}
5468
env:
5569
MNEMONIC: ${{ secrets.MNEMONICS }}
70+
MNEMONICS: ${{ secrets.MNEMONICS }}
5671
NETWORK: ${{ matrix.network }}
5772
working-directory: integrationtests
58-
run: go test -v ./... --tags=integration -run TestVM
73+
run: ${{ matrix.tests.test }}
74+
75+
test-qa:
76+
name: Testing
77+
runs-on: ubuntu-latest
78+
timeout-minutes: 0
79+
strategy:
80+
fail-fast: false
81+
max-parallel: 1
82+
matrix:
83+
network: ["qa"]
84+
tests: [{name: "vm", test: "go test -v ./... --tags=integration -run TestVM"},
85+
{name: "k8s", test: "go test -v ./... --tags=integration -run TestK8s"},
86+
{name: "gateway", test: "go test -v ./... --tags=integration -run TestGatewayDeployments"},
87+
{name: "gateway-private", test: "go test -v ./... --tags=integration -run TestGatewayPrivate"},
88+
{name: "wireguard", test: "go test -v ./... --tags=integration -run TestWireguard"},
89+
{name: "zdb", test: "go test -v ./... --tags=integration -run TestZdbs"},
90+
{name: "qsfs", test: "go test -v ./... --tags=integration -run TestQSFS"},
91+
{name: "peertube", test: "go test -v ./... --tags=integration -run TestPeertube"},
92+
{name: "presearch", test: "go test -v ./... --tags=integration -run TestPresearch"},
93+
{name: "taiga", test: "go test -v ./... --tags=integration -run TestTaiga"},
94+
{name: "mattermost", test: "go test -v ./... --tags=integration -run TestMattermost"}]
5995

60-
- name: Test kubernetes
96+
steps:
97+
- uses: actions/setup-go@v5
98+
with:
99+
go-version: 1.21
100+
- uses: autero1/action-terraform@v3.0.1
61101
env:
62-
MNEMONIC: ${{ secrets.MNEMONICS }}
63-
NETWORK: ${{ matrix.network }}
64-
working-directory: integrationtests
102+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
103+
with:
104+
terraform-version: 1.8.5
105+
- name: install wg and yggdrasil and add peers
65106
run: |
66-
go test -v ./... --tags=integration -run TestK8s
67-
go test -v ./... --tags=integration -run TestModuleK8s
68-
69-
- name: Test Gateways
70-
env:
71-
MNEMONIC: ${{ secrets.MNEMONICS }}
72-
NETWORK: ${{ matrix.network }}
73-
working-directory: integrationtests
74-
run: go test -v ./... --tags=integration -run TestGatewayDeployments
75-
76-
- name: Test private gateways
77-
env:
78-
MNEMONIC: ${{ secrets.MNEMONICS }}
79-
NETWORK: ${{ matrix.network }}
80-
working-directory: integrationtests
81-
run: go test -v ./... --tags=integration -run TestGatewayPrivate
82-
83-
- name: Test wireguard
84-
env:
85-
MNEMONIC: ${{ secrets.MNEMONICS }}
86-
NETWORK: ${{ matrix.network }}
87-
working-directory: integrationtests
88-
run: go test -v ./... --tags=integration -run TestWireguard
89-
90-
- name: Test ZDBs
91-
env:
92-
MNEMONIC: ${{ secrets.MNEMONICS }}
93-
NETWORK: ${{ matrix.network }}
94-
working-directory: integrationtests
95-
run: go test -v ./... --tags=integration -run TestZdbs
96-
97-
- name: Test QSFS
98-
env:
99-
MNEMONIC: ${{ secrets.MNEMONICS }}
100-
NETWORK: ${{ matrix.network }}
101-
working-directory: integrationtests
102-
run: go test -v ./... --tags=integration -run TestQSFS
103-
104-
- name: Test peertube
107+
sudo apt-get update
108+
sudo apt-get install -y wireguard
109+
sudo apt-get install dirmngr
110+
sudo apt-get install curl
111+
gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
112+
gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -
113+
echo 'deb http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list
114+
sudo apt-get update
115+
sudo apt-get install yggdrasil
116+
sudo systemctl enable yggdrasil
117+
PEERS=$(curl https://raw.githubusercontent.com/AhmedHanafy725/yggdrasil-config/main/config.json | jq '.yggdrasil.peers[]' -r | sed 's/\//\\\//g' | sed -z 's/\n/\\n/g')
118+
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
119+
sudo systemctl restart yggdrasil
120+
- uses: actions/checkout@v4
121+
with:
122+
fetch-depth: 0
123+
- name: Build
124+
run: |
125+
go mod tidy
126+
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
127+
go build -o terraform-provider-grid
128+
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
129+
- name: Test ${{ matrix.tests.name }}
105130
env:
106131
MNEMONIC: ${{ secrets.MNEMONICS }}
132+
MNEMONICS: ${{ secrets.MNEMONICS }}
107133
NETWORK: ${{ matrix.network }}
108134
working-directory: integrationtests
109-
run: go test -v ./... --tags=integration -run TestPeertube
135+
run: ${{ matrix.tests.test }}
136+
137+
test-test:
138+
name: Testing
139+
runs-on: ubuntu-latest
140+
timeout-minutes: 0
141+
strategy:
142+
fail-fast: false
143+
max-parallel: 1
144+
matrix:
145+
network: ["test"]
146+
tests: [{name: "vm", test: "go test -v ./... --tags=integration -run TestVM"},
147+
{name: "k8s", test: "go test -v ./... --tags=integration -run TestK8s"},
148+
{name: "gateway", test: "go test -v ./... --tags=integration -run TestGatewayDeployments"},
149+
{name: "gateway-private", test: "go test -v ./... --tags=integration -run TestGatewayPrivate"},
150+
{name: "wireguard", test: "go test -v ./... --tags=integration -run TestWireguard"},
151+
{name: "zdb", test: "go test -v ./... --tags=integration -run TestZdbs"},
152+
{name: "qsfs", test: "go test -v ./... --tags=integration -run TestQSFS"},
153+
{name: "peertube", test: "go test -v ./... --tags=integration -run TestPeertube"},
154+
{name: "presearch", test: "go test -v ./... --tags=integration -run TestPresearch"},
155+
{name: "taiga", test: "go test -v ./... --tags=integration -run TestTaiga"},
156+
{name: "mattermost", test: "go test -v ./... --tags=integration -run TestMattermost"}]
110157

111-
- name: Test presearch
158+
steps:
159+
- uses: actions/setup-go@v5
160+
with:
161+
go-version: 1.21
162+
- uses: autero1/action-terraform@v3.0.1
112163
env:
113-
MNEMONIC: ${{ secrets.MNEMONICS }}
114-
NETWORK: ${{ matrix.network }}
115-
working-directory: integrationtests
116-
run: go test -v ./... --tags=integration -run TestPresearch
117-
118-
- name: Test taiga
164+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
165+
with:
166+
terraform-version: 1.8.5
167+
- name: install wg and yggdrasil and add peers
168+
run: |
169+
sudo apt-get update
170+
sudo apt-get install -y wireguard
171+
sudo apt-get install dirmngr
172+
sudo apt-get install curl
173+
gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
174+
gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -
175+
echo 'deb http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list
176+
sudo apt-get update
177+
sudo apt-get install yggdrasil
178+
sudo systemctl enable yggdrasil
179+
PEERS=$(curl https://raw.githubusercontent.com/AhmedHanafy725/yggdrasil-config/main/config.json | jq '.yggdrasil.peers[]' -r | sed 's/\//\\\//g' | sed -z 's/\n/\\n/g')
180+
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
181+
sudo systemctl restart yggdrasil
182+
- uses: actions/checkout@v4
183+
with:
184+
fetch-depth: 0
185+
- name: Build
186+
run: |
187+
go mod tidy
188+
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
189+
go build -o terraform-provider-grid
190+
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
191+
- name: Test ${{ matrix.tests.name }}
119192
env:
120193
MNEMONIC: ${{ secrets.MNEMONICS }}
194+
MNEMONICS: ${{ secrets.MNEMONICS }}
121195
NETWORK: ${{ matrix.network }}
122196
working-directory: integrationtests
123-
run: go test -v ./... --tags=integration -run TestTaiga
197+
run: ${{ matrix.tests.test }}
198+
199+
test-main:
200+
name: Testing
201+
runs-on: ubuntu-latest
202+
timeout-minutes: 0
203+
strategy:
204+
fail-fast: false
205+
max-parallel: 1
206+
matrix:
207+
network: ["main"]
208+
tests: [{name: "vm", test: "go test -v ./... --tags=integration -run TestVM"},
209+
{name: "k8s", test: "go test -v ./... --tags=integration -run TestK8s"},
210+
{name: "gateway", test: "go test -v ./... --tags=integration -run TestGatewayDeployments"},
211+
{name: "gateway-private", test: "go test -v ./... --tags=integration -run TestGatewayPrivate"},
212+
{name: "wireguard", test: "go test -v ./... --tags=integration -run TestWireguard"},
213+
{name: "zdb", test: "go test -v ./... --tags=integration -run TestZdbs"},
214+
{name: "qsfs", test: "go test -v ./... --tags=integration -run TestQSFS"},
215+
{name: "peertube", test: "go test -v ./... --tags=integration -run TestPeertube"},
216+
{name: "presearch", test: "go test -v ./... --tags=integration -run TestPresearch"},
217+
{name: "taiga", test: "go test -v ./... --tags=integration -run TestTaiga"},
218+
{name: "mattermost", test: "go test -v ./... --tags=integration -run TestMattermost"}]
124219

125-
- name: Test mattermost
220+
steps:
221+
- uses: actions/setup-go@v5
222+
with:
223+
go-version: 1.21
224+
- uses: autero1/action-terraform@v3.0.1
126225
env:
127-
MNEMONIC: ${{ secrets.MNEMONICS }}
128-
NETWORK: ${{ matrix.network }}
129-
working-directory: integrationtests
130-
run: go test -v ./... --tags=integration -run TestMattermost
131-
132-
- name: Test nomad
226+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
227+
with:
228+
terraform-version: 1.8.5
229+
- name: install wg and yggdrasil and add peers
230+
run: |
231+
sudo apt-get update
232+
sudo apt-get install -y wireguard
233+
sudo apt-get install dirmngr
234+
sudo apt-get install curl
235+
gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
236+
gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -
237+
echo 'deb http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list
238+
sudo apt-get update
239+
sudo apt-get install yggdrasil
240+
sudo systemctl enable yggdrasil
241+
PEERS=$(curl https://raw.githubusercontent.com/AhmedHanafy725/yggdrasil-config/main/config.json | jq '.yggdrasil.peers[]' -r | sed 's/\//\\\//g' | sed -z 's/\n/\\n/g')
242+
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
243+
sudo systemctl restart yggdrasil
244+
- uses: actions/checkout@v4
245+
with:
246+
fetch-depth: 0
247+
- name: Build
248+
run: |
249+
go mod tidy
250+
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
251+
go build -o terraform-provider-grid
252+
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
253+
- name: Test ${{ matrix.tests.name }}
133254
env:
134255
MNEMONIC: ${{ secrets.MNEMONICS }}
256+
MNEMONICS: ${{ secrets.MNEMONICS }}
135257
NETWORK: ${{ matrix.network }}
136258
working-directory: integrationtests
137-
run: go test -v ./... --tags=integration -run TestNomad
138-
259+
run: ${{ matrix.tests.test }}

.github/workflows/test_modules.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Intgeration tests for modules
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
go-tests:
10+
name: Run Go Tests
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 0
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
network: ["dev", "qa", "test", "main"]
17+
steps:
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: 1.21
21+
- uses: autero1/action-terraform@v3.0.1
22+
env:
23+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
24+
with:
25+
terraform-version: 1.8.5
26+
- name: install wg and yggdrasil and add peers
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y wireguard
30+
sudo apt-get install dirmngr
31+
sudo apt-get install curl
32+
gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
33+
gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -
34+
echo 'deb http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list
35+
sudo apt-get update
36+
sudo apt-get install yggdrasil
37+
sudo systemctl enable yggdrasil
38+
PEERS=$(curl https://raw.githubusercontent.com/AhmedHanafy725/yggdrasil-config/main/config.json | jq '.yggdrasil.peers[]' -r | sed 's/\//\\\//g' | sed -z 's/\n/\\n/g')
39+
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
40+
sudo systemctl restart yggdrasil
41+
- uses: actions/checkout@v4.1.1
42+
with:
43+
fetch-depth: 0
44+
- name: Build
45+
run: |
46+
go mod tidy
47+
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
48+
go build -o terraform-provider-grid
49+
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
50+
- name: Test kubernetes module
51+
env:
52+
MNEMONIC: ${{ secrets.MNEMONICS }}
53+
NETWORK: ${{ matrix.network }}
54+
working-directory: integrationtests
55+
run: |
56+
go test -v ./... --tags=integration -run TestModuleK8s
57+
58+
- name: Test Gateways
59+
env:
60+
MNEMONIC: ${{ secrets.MNEMONICS }}
61+
NETWORK: ${{ matrix.network }}
62+
working-directory: integrationtests
63+
run: go test -v ./... --tags=integration -run TestGatewayDeployments
64+
65+
- name: Test nomad module
66+
env:
67+
MNEMONIC: ${{ secrets.MNEMONICS }}
68+
NETWORK: ${{ matrix.network }}
69+
working-directory: integrationtests
70+
run: go test -v ./... --tags=integration -run TestNomad

.golangci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ linters:
55
- gofmt
66
- govet
77
- ineffassign
8-
- megacheck
8+
- gosimple
9+
- staticcheck
10+
- unused
911
- misspell
1012
- unconvert
1113
enable-all: false
1214
run:
1315
timeout: 20m
14-
skip-dirs:
16+
issues:
17+
exclude-dirs:
1518
- integrationtests

0 commit comments

Comments
 (0)