Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split integration tests and update sdk #966

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 189 additions & 68 deletions .github/workflows/terratest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,35 @@ name: Intgeration tests

on:
schedule:
- cron: "0 0 * * *"
- cron: "0 1 * * *"
workflow_dispatch:
push:
tags:
- "v*"

jobs:
go-tests:
name: Run Go Tests
test-dev:
name: Testing
runs-on: ubuntu-latest
timeout-minutes: 0
strategy:
fail-fast: false
max-parallel: 1
matrix:
network: ["dev", "qa", "test", "main"]
# network: ["dev", "qa", "test", "main"]
network: ["dev"]
tests: [{name: "vm", test: "go test -v ./... --tags=integration -run TestVM"},
{name: "k8s", test: "go test -v ./... --tags=integration -run TestK8s"},
{name: "gateway", test: "go test -v ./... --tags=integration -run TestGatewayDeployments"},
{name: "gateway-private", test: "go test -v ./... --tags=integration -run TestGatewayPrivate"},
{name: "wireguard", test: "go test -v ./... --tags=integration -run TestWireguard"},
{name: "zdb", test: "go test -v ./... --tags=integration -run TestZdbs"},
{name: "qsfs", test: "go test -v ./... --tags=integration -run TestQSFS"},
{name: "peertube", test: "go test -v ./... --tags=integration -run TestPeertube"},
{name: "presearch", test: "go test -v ./... --tags=integration -run TestPresearch"},
{name: "taiga", test: "go test -v ./... --tags=integration -run TestTaiga"},
{name: "mattermost", test: "go test -v ./... --tags=integration -run TestMattermost"}]

steps:
- uses: actions/setup-go@v5
with:
Expand All @@ -41,7 +55,7 @@ jobs:
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')
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
sudo systemctl restart yggdrasil
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
Expand All @@ -50,89 +64,196 @@ jobs:
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
go build -o terraform-provider-grid
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
- name: Test virtual machines
- name: Test ${{ matrix.tests.name }}
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestVM
run: ${{ matrix.tests.test }}

test-qa:
name: Testing
runs-on: ubuntu-latest
timeout-minutes: 0
strategy:
fail-fast: false
max-parallel: 1
matrix:
network: ["qa"]
tests: [{name: "vm", test: "go test -v ./... --tags=integration -run TestVM"},
{name: "k8s", test: "go test -v ./... --tags=integration -run TestK8s"},
{name: "gateway", test: "go test -v ./... --tags=integration -run TestGatewayDeployments"},
{name: "gateway-private", test: "go test -v ./... --tags=integration -run TestGatewayPrivate"},
{name: "wireguard", test: "go test -v ./... --tags=integration -run TestWireguard"},
{name: "zdb", test: "go test -v ./... --tags=integration -run TestZdbs"},
{name: "qsfs", test: "go test -v ./... --tags=integration -run TestQSFS"},
{name: "peertube", test: "go test -v ./... --tags=integration -run TestPeertube"},
{name: "presearch", test: "go test -v ./... --tags=integration -run TestPresearch"},
{name: "taiga", test: "go test -v ./... --tags=integration -run TestTaiga"},
{name: "mattermost", test: "go test -v ./... --tags=integration -run TestMattermost"}]

- name: Test kubernetes
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: autero1/[email protected]
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
terraform-version: 1.8.5
- name: install wg and yggdrasil and add peers
run: |
go test -v ./... --tags=integration -run TestK8s
go test -v ./... --tags=integration -run TestModuleK8s

- name: Test Gateways
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestGatewayDeployments

- name: Test private gateways
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestGatewayPrivate

- name: Test wireguard
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestWireguard

- name: Test ZDBs
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestZdbs

- name: Test QSFS
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestQSFS

- name: Test peertube
sudo apt-get update
sudo apt-get install -y wireguard
sudo apt-get install dirmngr
sudo apt-get install curl
gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -
echo 'deb http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list
sudo apt-get update
sudo apt-get install yggdrasil
sudo systemctl enable yggdrasil
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')
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
sudo systemctl restart yggdrasil
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
go mod tidy
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
go build -o terraform-provider-grid
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
- name: Test ${{ matrix.tests.name }}
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestPeertube
run: ${{ matrix.tests.test }}

test-test:
name: Testing
runs-on: ubuntu-latest
timeout-minutes: 0
strategy:
fail-fast: false
max-parallel: 1
matrix:
network: ["test"]
tests: [{name: "vm", test: "go test -v ./... --tags=integration -run TestVM"},
{name: "k8s", test: "go test -v ./... --tags=integration -run TestK8s"},
{name: "gateway", test: "go test -v ./... --tags=integration -run TestGatewayDeployments"},
{name: "gateway-private", test: "go test -v ./... --tags=integration -run TestGatewayPrivate"},
{name: "wireguard", test: "go test -v ./... --tags=integration -run TestWireguard"},
{name: "zdb", test: "go test -v ./... --tags=integration -run TestZdbs"},
{name: "qsfs", test: "go test -v ./... --tags=integration -run TestQSFS"},
{name: "peertube", test: "go test -v ./... --tags=integration -run TestPeertube"},
{name: "presearch", test: "go test -v ./... --tags=integration -run TestPresearch"},
{name: "taiga", test: "go test -v ./... --tags=integration -run TestTaiga"},
{name: "mattermost", test: "go test -v ./... --tags=integration -run TestMattermost"}]

- name: Test presearch
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: autero1/[email protected]
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestPresearch

- name: Test taiga
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
terraform-version: 1.8.5
- name: install wg and yggdrasil and add peers
run: |
sudo apt-get update
sudo apt-get install -y wireguard
sudo apt-get install dirmngr
sudo apt-get install curl
gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -
echo 'deb http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list
sudo apt-get update
sudo apt-get install yggdrasil
sudo systemctl enable yggdrasil
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')
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
sudo systemctl restart yggdrasil
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
go mod tidy
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
go build -o terraform-provider-grid
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
- name: Test ${{ matrix.tests.name }}
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestTaiga
run: ${{ matrix.tests.test }}

test-main:
name: Testing
runs-on: ubuntu-latest
timeout-minutes: 0
strategy:
fail-fast: false
max-parallel: 1
matrix:
network: ["main"]
tests: [{name: "vm", test: "go test -v ./... --tags=integration -run TestVM"},
{name: "k8s", test: "go test -v ./... --tags=integration -run TestK8s"},
{name: "gateway", test: "go test -v ./... --tags=integration -run TestGatewayDeployments"},
{name: "gateway-private", test: "go test -v ./... --tags=integration -run TestGatewayPrivate"},
{name: "wireguard", test: "go test -v ./... --tags=integration -run TestWireguard"},
{name: "zdb", test: "go test -v ./... --tags=integration -run TestZdbs"},
{name: "qsfs", test: "go test -v ./... --tags=integration -run TestQSFS"},
{name: "peertube", test: "go test -v ./... --tags=integration -run TestPeertube"},
{name: "presearch", test: "go test -v ./... --tags=integration -run TestPresearch"},
{name: "taiga", test: "go test -v ./... --tags=integration -run TestTaiga"},
{name: "mattermost", test: "go test -v ./... --tags=integration -run TestMattermost"}]

- name: Test mattermost
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: autero1/[email protected]
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestMattermost

- name: Test nomad
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
terraform-version: 1.8.5
- name: install wg and yggdrasil and add peers
run: |
sudo apt-get update
sudo apt-get install -y wireguard
sudo apt-get install dirmngr
sudo apt-get install curl
gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -
echo 'deb http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list
sudo apt-get update
sudo apt-get install yggdrasil
sudo systemctl enable yggdrasil
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')
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
sudo systemctl restart yggdrasil
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
go mod tidy
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
go build -o terraform-provider-grid
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
- name: Test ${{ matrix.tests.name }}
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestNomad

run: ${{ matrix.tests.test }}
70 changes: 70 additions & 0 deletions .github/workflows/test_modules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Intgeration tests for modules

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
go-tests:
name: Run Go Tests
runs-on: ubuntu-latest
timeout-minutes: 0
strategy:
fail-fast: false
matrix:
network: ["dev", "qa", "test", "main"]
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: autero1/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
terraform-version: 1.8.5
- name: install wg and yggdrasil and add peers
run: |
sudo apt-get update
sudo apt-get install -y wireguard
sudo apt-get install dirmngr
sudo apt-get install curl
gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
gpg --export 569130E8CA20FBC4CB3FDE555898470A764B32C9 | sudo apt-key add -
echo 'deb http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil' | sudo tee /etc/apt/sources.list.d/yggdrasil.list
sudo apt-get update
sudo apt-get install yggdrasil
sudo systemctl enable yggdrasil
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')
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
sudo systemctl restart yggdrasil
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Build
run: |
go mod tidy
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
go build -o terraform-provider-grid
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
- name: Test kubernetes module
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: |
go test -v ./... --tags=integration -run TestModuleK8s
- name: Test Gateways
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestGatewayDeployments

- name: Test nomad module
env:
MNEMONIC: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestNomad
7 changes: 5 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ linters:
- gofmt
- govet
- ineffassign
- megacheck
- gosimple
- staticcheck
- unused
- misspell
- unconvert
enable-all: false
run:
timeout: 20m
skip-dirs:
issues:
exclude-dirs:
- integrationtests
Loading
Loading