Skip to content

Commit

Permalink
chore: replace kuttl tests with chainsaw (#3000)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly committed Feb 9, 2024
1 parent 1689f8f commit 2f77ae8
Show file tree
Hide file tree
Showing 238 changed files with 21 additions and 7,239 deletions.
4 changes: 0 additions & 4 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,9 @@ kubeflow
kubescape
kubescheduler
kubeutils
kudobuilder
kustomization
kustomize
kustomizeconfig
kuttl
kwi
kwv
kyverno
Expand Down Expand Up @@ -421,7 +419,6 @@ mysecret
myservice
myuser
myversion
namespacedelete
netlify
nifi
nilnil
Expand Down Expand Up @@ -603,7 +600,6 @@ testcertificate
testcommon
testmetrics
testreg
teststep
tgz
thisthatdc
thschue
Expand Down
60 changes: 3 additions & 57 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ on:
default: allowed_ns_off
env:
GO_VERSION: "~1.20"
# renovate: datasource=github-tags depName=kudobuilder/kuttl
KUTTL_VERSION: "v0.15.0"
defaults:
run:
shell: bash

jobs:
run-integration-test:
name: Run Integration Tests
name: Run Chainsaw Tests
runs-on: ubuntu-22.04
steps:
- name: Check out code
Expand All @@ -40,13 +38,8 @@ jobs:
- name: Install and expose Prometheus
uses: ./.github/actions/deploy-prometheus-on-cluster

- name: Download KUTTL
env:
BASE_URL: "https://github.com/kudobuilder/kuttl/releases"
run: |
curl -fL "${BASE_URL}/download/${{ env.KUTTL_VERSION }}/kubectl-kuttl_${KUTTL_VERSION#v}_linux_x86_64" -o kubectl-kuttl
chmod +x kubectl-kuttl
mv kubectl-kuttl /usr/local/bin
- name: Install Chainsaw
uses: kyverno/action-install-chainsaw@56be3cb4ec65a987b6ef4d7ab3a55ee17760a57c # v0.1.2

- name: Run Scheduling Gates Integration Tests
if: inputs.scheduling-gates == 'gates_on' && inputs.allowed-namespaces == 'allowed_ns_off'
Expand Down Expand Up @@ -74,50 +67,3 @@ jobs:
with:
name: logs-integration-tests-${{ inputs.scheduling-gates }}-${{ inputs.allowed-namespaces }}
path: .github/scripts/logs

run-chainsaw-test:
name: Run Chainsaw Tests
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup cluster
uses: ./.github/actions/deploy-keptn-on-cluster
with:
runtime_tag: ${{ inputs.runtime_tag }}
scheduling-gates: ${{ inputs.scheduling-gates }}
allowed-namespaces: ${{ inputs.allowed-namespaces }}

- name: Install and expose Prometheus
uses: ./.github/actions/deploy-prometheus-on-cluster

- name: Install Chainsaw
uses: kyverno/action-install-chainsaw@56be3cb4ec65a987b6ef4d7ab3a55ee17760a57c # v0.1.2

- name: (Chainsaw) Run Scheduling Gates Integration Tests
if: inputs.scheduling-gates == 'gates_on' && inputs.allowed-namespaces == 'allowed_ns_off'
working-directory: .
run: make chainsaw-integration-test-scheduling-gates

- name: (Chainsaw) Run Allowed namespaces Integration Tests
if: inputs.allowed-namespaces == 'allowed_ns_on'
working-directory: .
run: make chainsaw-integration-test-allowed-namespaces

- name: (Chainsaw) Run Integration Tests
if: inputs.allowed-namespaces == 'allowed_ns_off'
working-directory: .
run: make chainsaw-integration-test

- name: Create reports
if: failure()
working-directory: ./.github/scripts
run: ./create-reports-full.sh

- name: Upload cluster logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: logs-chainsaw-integration-tests-${{ inputs.scheduling-gates }}-${{ inputs.allowed-namespaces }}
path: .github/scripts/logs
3 changes: 1 addition & 2 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sonar.projectKey=keptn_lifecycle-toolkit
sonar.projectName=lifecycle-toolkit
sonar.exclusions=test/kuttl/**/*.yaml,\
test/chainsaw/**/*.yaml,\
sonar.exclusions=test/chainsaw/**/*.yaml,\
docs/docs/**/*.yaml,\
test/prometheus/**/*.yaml,\
examples/**/*.yaml
Expand Down
58 changes: 12 additions & 46 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,74 +22,40 @@ $(LOCALBIN):
## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize

#########
# KUTTL #
#########

.PHONY: integration-test #these tests should run on a real cluster!
integration-test: # to run a single test by name use --test eg. --test=expose-keptn-metric
kubectl kuttl test --start-kind=false ./test/kuttl/integration/ --config=kuttl-test.yaml
kubectl kuttl test --start-kind=false ./test/kuttl/testmetrics/ --config=kuttl-test.yaml
kubectl kuttl test --start-kind=false ./test/kuttl/testanalysis/ --config=kuttl-test.yaml
kubectl kuttl test --start-kind=false ./test/kuttl/testcertificate/ --config=kuttl-test.yaml

.PHONY: integration-test-local #these tests should run on a real cluster!
integration-test-local: install-prometheus
kubectl kuttl test --start-kind=false ./test/kuttl/integration/ --config=kuttl-test-local.yaml
kubectl kuttl test --start-kind=false ./test/kuttl/testmetrics/ --config=kuttl-test-local.yaml
kubectl kuttl test --start-kind=false ./test/kuttl/testanalysis/ --config=kuttl-test-local.yaml
kubectl kuttl test --start-kind=false ./test/kuttl/testcertificate/ --config=kuttl-test-local.yaml

.PHONY: integration-test-scheduling-gates #these tests should run on a real cluster!
integration-test-scheduling-gates: # to run a single test by name use --test eg. --test=expose-keptn-metric
kubectl kuttl test --start-kind=false ./test/kuttl/scheduling-gates/ --config=kuttl-test.yaml

.PHONY: integration-test-scheduling-gates-local #these tests should run on a real cluster!
integration-test-scheduling-gates-local: install-prometheus
kubectl kuttl test --start-kind=false ./test/kuttl/scheduling-gates/ --config=kuttl-test-local.yaml

.PHONY: integration-test-allowed-namespaces #these tests should run on a real cluster!
integration-test-allowed-namespaces: # to run a single test by name use --test eg. --test=expose-keptn-metric
kubectl kuttl test --start-kind=false ./test/kuttl/allowed-namespaces/ --config=kuttl-test.yaml

.PHONY: integration-test-allowed-namespaces-local #these tests should run on a real cluster!
integration-test-allowed-namespaces-local: install-prometheus
kubectl kuttl test --start-kind=false ./test/kuttl/allowed-namespaces/ --config=kuttl-test-local.yaml

############
# CHAINSAW #
############

.PHONY: chainsaw-integration-test #these tests should run on a real cluster!
chainsaw-integration-test:
.PHONY: integration-test #these tests should run on a real cluster!
integration-test:
kubectl apply -f ./lifecycle-operator/config/crd/bases
chainsaw test --test-dir ./test/chainsaw/integration/
chainsaw test --test-dir ./test/chainsaw/testmetrics/
chainsaw test --test-dir ./test/chainsaw/testanalysis/
chainsaw test --test-dir ./test/chainsaw/testcertificate/

.PHONY: chainsaw-integration-test-local #these tests should run on a real cluster!
chainsaw-integration-test-local:
.PHONY: integration-test-local #these tests should run on a real cluster!
integration-test-local:
kubectl apply -f ./lifecycle-operator/config/crd/bases
chainsaw test --test-dir ./test/chainsaw/integration/ --config ./.chainsaw-local.yaml
chainsaw test --test-dir ./test/chainsaw/testmetrics/ --config ./.chainsaw-local.yaml
chainsaw test --test-dir ./test/chainsaw/testanalysis/ --config ./.chainsaw-local.yaml
chainsaw test --test-dir ./test/chainsaw/testcertificate/ --config ./.chainsaw-local.yaml

.PHONY: chainsaw-integration-test-scheduling-gates #these tests should run on a real cluster!
chainsaw-integration-test-scheduling-gates:
.PHONY: integration-test-scheduling-gates #these tests should run on a real cluster!
integration-test-scheduling-gates:
chainsaw test --test-dir ./test/chainsaw/scheduling-gates/

.PHONY: chainsaw-integration-test-scheduling-gates-local #these tests should run on a real cluster!
chainsaw-integration-test-scheduling-gates-local: install-prometheus
.PHONY: integration-test-scheduling-gates-local #these tests should run on a real cluster!
integration-test-scheduling-gates-local: install-prometheus
chainsaw test --test-dir ./test/chainsaw/scheduling-gates/ --config ./.chainsaw-local.yaml

.PHONY: chainsaw-integration-test-allowed-namespaces #these tests should run on a real cluster!
chainsaw-integration-test-allowed-namespaces:
.PHONY: integration-test-allowed-namespaces #these tests should run on a real cluster!
integration-test-allowed-namespaces:
chainsaw test --test-dir ./test/chainsaw/allowed-namespaces/

.PHONY: chainsaw-integration-test-allowed-namespaces-local #these tests should run on a real cluster!
chainsaw-integration-test-allowed-namespaces-local: install-prometheus
.PHONY: integration-test-allowed-namespaces-local #these tests should run on a real cluster!
integration-test-allowed-namespaces-local: install-prometheus
chainsaw test --test-dir ./test/chainsaw/allowed-namespaces/ --config ./.chainsaw-local.yaml

.PHONY: load-test
Expand Down
4 changes: 0 additions & 4 deletions docs/docs/contribute/general/technologies.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ for working with and contributing to Keptn.
is used with the
[Gomega matcher](https://onsi.github.io/gomega/)
to implement component tests and end-to-end tests.
* **KUTTL (KUbernetes Test TooL)**
Some test tools are written in KUTTL
* [KUTTL web page](https://kuttl.dev/)
has information to get you started
* **Chainsaw**
Some test tools are written with chainsaw
* [Chainsaw web page](https://kyverno.github.io/chainsaw/)
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/contribute/software/dev-environ.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ before you create a PR with your changes.

If your change introduces a new feature,
you may need to update the test suites to cover your changes.
These tests use basic go-library, Ginkgo or KUTTL tests.
These tests use basic go-library, Ginkgo or chainsaw tests.
You can ask the maintainers to tell you where to put your additional test data.

Tests are run on your local machine.
Expand All @@ -161,10 +161,10 @@ Run the integration tests from the root directory of your clone:
make integration-test-local
```

This runs a series of Kuttl
([KUbernetes Test TooL](https://kuttl.dev/))
This runs a series of chainsaw
([chainsaw](https://kyverno.github.io/chainsaw))
tests locally and then cleans up your local environment.
You can run individual tests with the `kubectl kuttl` command;
You can run individual tests with the `chainsaw test` command;
see the *Makefile* for the specific syntax of each test.

### Component test
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/slo.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ so, in this case, the query becomes:
The other key-value pairs such as 'project' and 'stage' are just examples of how one could pass to the provider
information similar to Keptn v1 objectives.
For a working example, you can
check [here](https://github.com/keptn/lifecycle-toolkit/tree/main/test/kuttl/testanalysis/analysis-controller-multiple-providers).
check [here](https://github.com/keptn/lifecycle-toolkit/tree/main/test/chainsaw/testanalysis/analysis-controller-multiple-providers).

## Accessing Analysis

Expand Down
6 changes: 0 additions & 6 deletions kuttl-test-local.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions kuttl-test.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 2f77ae8

Please sign in to comment.