Skip to content

feat: add delete --all flag #75

feat: add delete --all flag

feat: add delete --all flag #75

Workflow file for this run

name: tests
on: [push]
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build coverage-instrumented binary
run: |
make build-cover && sudo make -B install
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Run Unit-Test
run: |
mkdir /tmp/unit/
go test \
-v \
-cover ./... \
-skip TestFwdctl \
-args -test.gocoverdir=/tmp/unit/
- name: Upload cover profiles
uses: actions/upload-artifact@v3
with:
name: unit-test
path: /tmp/unit/
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build coverage-instrumented binary
run: |
make build-cover && sudo make -B install
- name: Run integration test
run: |
mkdir /tmp/integration
# we have to run integration tests one-by-one
# otherwhise they will run in parallel.
# since fwdctl apply network forwards, these could
# interact with each other and make the test fail.
go test \
-exec sudo \
-cover \
-v ./... \
-run TestFwdctl/apply \
-args -test.gocoverdir=/tmp/integration/
go test \
-exec sudo \
-cover \
-v ./... \
-run TestFwdctl/create \
-args -test.gocoverdir=/tmp/integration/
go test \
-exec sudo \
-cover \
-v ./... \
-run TestFwdctl/delete \
-args -test.gocoverdir=/tmp/integration/
go test \
-exec sudo \
-cover \
-v ./... \
-run TestFwdctl/list \
-args -test.gocoverdir=/tmp/integration/
- name: Upload cover profiles
uses: actions/upload-artifact@v3
with:
name: integration-test
path: /tmp/integration/
code-coverage:
runs-on: ubuntu-latest
needs: [unit-test,integration-test]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: unit-test
path: /tmp/unit-test
- uses: actions/download-artifact@v3
with:
name: integration-test
path: /tmp/integration-test
- name: list files
run: |
ls -lah /tmp/unit-test
ls -lah /tmp/integration-test
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Calculate total coverage
run: |
go tool \
covdata \
textfmt \
-i=/tmp/unit-test,/tmp/integration-test \
-o code-coverage
go tool \
cover \
-func code-coverage