Skip to content

Commit

Permalink
Add Calico scenario (#182)
Browse files Browse the repository at this point in the history
Support for calico in integration tests. As part of this change, the cni-plugin test harness has been modified to support a more generic pattern for scenario creation. Additionally, a test-util has been introduced for the CNI plugin. Along with these two changes, the justfile and workflow file had to be changed to support the new tests.

Signed-off-by: Matei David <[email protected]>
  • Loading branch information
mateiidavid authored Feb 9, 2023
1 parent 09821f7 commit 360693b
Show file tree
Hide file tree
Showing 12 changed files with 4,259 additions and 145 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/cni-plugin-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ on:
- cni-plugin/**

jobs:
integration:
cni-flannel-test:
continue-on-error: true
timeout-minutes: 15
runs-on: ubuntu-20.04
steps:
- uses: linkerd/dev/actions/setup-tools@v39
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- run: just k3d-create
- run: just build-cni-plugin-image
- run: just build-cni-plugin-test-image
- run: just cni-plugin-test-integration
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Run CNI integration tests
run: just cni-plugin-test-integration-flannel
cni-calico-test:
continue-on-error: true
timeout-minutes: 15
runs-on: ubuntu-20.04
steps:
- uses: linkerd/dev/actions/setup-tools@v39
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Run CNI integration tests
run: just cni-plugin-test-integration-calico
13 changes: 4 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ on:
- proxy-init/**

jobs:
integration:
proxy-init-integration:
continue-on-error: true
timeout-minutes: 15
runs-on: ubuntu-20.04
steps:
- uses: linkerd/dev/actions/setup-tools@v39
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- run: just k3d-create
- run: just build-proxy-init-image
- run: just build-proxy-init-test-image
- run: just proxy-init-test-integration-deps
- run: just proxy-init-test-integration-run
- run: just build-cni-plugin-image
- run: just build-cni-plugin-test-image
- run: just cni-plugin-test-integration
- name: Run proxy-init integration tests
run: just proxy-init-test-integration
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,45 @@ requires the NET_ADMIN capability.

## Integration tests

Assuming that you have `k3d` installed locally (as is included in the
Devcontainer):
Both the cni-plugin and the proxy-init binary have their own integration tests
that must be triggered separately. For convenience, both of them have `just`
recipes that can be used to trigger the tests locally, or in CI.

For the tests to be run, `k3d` needs to be installed locally (assumption is
that this true, since the project offers a Devcontainer).

```bash
# List all available recipes
just --list

# Run proxy-init integration tests
just proxy-init-test-integration

## Run cni plugin integration tests
# cni plugin contains more than one scenario:
# for example, tests may be run with calico, or
# with flannel (default on k3d).
# Each plugin requires a different k3d config.
## To run _all_ the tests
just cni-plugin-test-integration-all

# Run a specific scenario, e.g flannel:
just cni-plugin-test-integration-flannel

# Run a test with a new scenario
# useful when developing or adding a new scenario
just \
cni-integration-scenario="myscenario"
cni-plugin-test-integration
```

By default, all `just` recipes prepare the relevant dependencies (e.g images,
clusters, and so on). Although it is not recommended, tests may be run
exclusively without preparing any dependencies. They can be trigger either
through `just` or by calling the test runner directly.

```bash
just test-integration
just \
cni-integration-scenario="<flannel | calico>" \
_cni-plugin-test-integration
```
91 changes: 0 additions & 91 deletions cni-plugin/integration/flannel/flannel_test.go

This file was deleted.

Loading

0 comments on commit 360693b

Please sign in to comment.