Skip to content

Commit 6bae33e

Browse files
committed
chore: migrate from kuttl to chainsaw
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
1 parent 9ba98c5 commit 6bae33e

File tree

8 files changed

+90
-32
lines changed

8 files changed

+90
-32
lines changed

.chainsaw.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json
2+
apiVersion: chainsaw.kyverno.io/v1alpha1
3+
kind: Configuration
4+
metadata:
5+
name: configuration
6+
spec:
7+
namespace: grafana-operator-system
8+
timeouts:
9+
assert: 2m0s
10+
cleanup: 2m0s
11+
delete: 2m0s
12+
error: 2m0s
13+
exec: 2m0s

.github/workflows/e2e.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ jobs:
7575
- name: Run e2e
7676
shell: bash
7777
run: |
78-
# install kuttl
79-
make kuttl
78+
# install chainsaw
79+
make chainsaw
8080
# Run e2e
8181
VERSION=latest make e2e
8282

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Thank you for investing your time in contributing to our project.
44

55
## Development
66

7-
The operator uses unit tests and [Kuttl](https://kuttl.dev/) for e2e tests to make sure that the operator is working as intended, we use make to generate a number of docs and scripts for us.
7+
The operator uses unit tests and [chainsaw](https://kyverno.github.io/chainsaw/) for e2e tests to make sure that the operator is working as intended, we use make to generate a number of docs and scripts for us.
88

99
The operator embeds [grafonnet-lib](https://github.com/grafana/grafonnet-lib) inside `embeds/grafonnet-lib`. It used to be a git submodule, however, as that folder was only filled when the git submodule was initiated, the grafana-operator couldn't be imported externally.
1010

@@ -67,9 +67,9 @@ make run
6767
To interact wit the cluster through kubectl you can ether run `kind export kubeconfig -n kind-grafana`
6868
or follow the instructions in the output from the script.
6969

70-
### E2e tests using Kuttl
70+
### E2e tests using chainsaw
7171

72-
As mentioned above we use Kuttl to run e2e tests for the operator, we normally run Kuttl on [Kind](https://kind.sigs.k8s.io/)
72+
As mentioned above we use chainsaw to run e2e tests for the operator, we normally run chainsaw on [Kind](https://kind.sigs.k8s.io/)
7373

7474
The `make e2e` command will
7575

@@ -78,7 +78,7 @@ The `make e2e` command will
7878
make ko-build-kind
7979
# Create grafana-operator-system namespace
8080
kubectl create ns grafana-operator-system
81-
# Run the Kuttl tests
81+
# Run the chainsaw tests
8282
VERSION=latest make e2e
8383
```
8484

Makefile

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ else
4040
GOBIN=$(shell go env GOBIN)
4141
endif
4242

43-
# Checks if kuttl is in your PATH
44-
ifneq ($(shell which kubectl-kuttl),)
45-
KUTTL=$(shell which kubectl-kuttl)
43+
# Checks if chainsaw is in your PATH
44+
ifneq ($(shell which chainsaw),)
45+
CHAINSAW=$(shell which chainsaw)
4646
else
47-
KUTTL=$(shell pwd)/bin/kubectl-kuttl
47+
CHAINSAW=$(shell pwd)/bin/chainsaw
4848
endif
4949

5050
# Setting SHELL to bash allows bash commands to be executed by recipes.
@@ -151,9 +151,9 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
151151
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
152152
$(KUSTOMIZE) build config/default | kubectl apply -f -
153153

154-
.PHONY: deploy-kuttl
155-
deploy-kuttl: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
156-
$(KUSTOMIZE) build config/kuttl-overlay | kubectl apply -f -
154+
.PHONY: deploy-chainsaw
155+
deploy-chainsaw: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
156+
$(KUSTOMIZE) build config/chainsaw-overlay | kubectl apply -f -
157157

158158
.PHONY: undeploy
159159
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
@@ -247,19 +247,19 @@ bundle/redhat: bundle
247247

248248
# e2e
249249
.PHONY: e2e
250-
e2e: kuttl install deploy-kuttl ## Run e2e tests using kuttl.
251-
$(KUTTL) test
250+
e2e: chainsaw install deploy-chainsaw ## Run e2e tests using chainsaw.
251+
$(CHAINSAW) test --test-dir ./tests/e2e
252252

253-
# Find or download kuttl
254-
kuttl:
255-
ifeq (, $(shell which kubectl-kuttl))
253+
# Find or download chainsaw
254+
chainsaw:
255+
ifeq (, $(shell which chainsaw))
256256
@{ \
257257
set -e ;\
258-
go install github.com/kudobuilder/kuttl/cmd/kubectl-kuttl@v0.12.1 ;\
258+
go install github.com/kyverno/chainsaw@v0.1.3 ;\
259259
}
260-
KUTTL=$(GOBIN)/kubectl-kuttl
260+
CHAINSAW=$(GOBIN)/chainsaw
261261
else
262-
KUTTL=$(shell which kubectl-kuttl)
262+
CHAINSAW=$(shell which chainsaw)
263263
endif
264264

265265
golangci:

kuttl-test.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
2+
apiVersion: chainsaw.kyverno.io/v1alpha1
3+
kind: Test
4+
metadata:
5+
creationTimestamp: null
6+
name: example-test
7+
spec:
8+
steps:
9+
- name: step-00
10+
try:
11+
- apply:
12+
file: 00-create-external-grafana.yaml
13+
- apply:
14+
file: 00-create-grafana.yaml
15+
- assert:
16+
file: 00-assert.yaml
17+
- name: step-01
18+
try:
19+
- apply:
20+
file: 01-datasource.yaml
21+
- assert:
22+
file: 01-assert.yaml
23+
- name: step-02
24+
try:
25+
- assert:
26+
file: 02-assert.yaml
27+
- name: step-03
28+
try:
29+
- apply:
30+
file: 03-dashboard.yaml
31+
- assert:
32+
file: 03-assert.yaml
33+
- name: step-04
34+
try:
35+
- apply:
36+
file: 04-dashboard.yaml
37+
- assert:
38+
file: 04-assert.yaml
39+
- name: step-05
40+
try:
41+
- apply:
42+
file: 05-dashboard.yaml
43+
- assert:
44+
file: 05-assert.yaml
45+
- name: step-06
46+
try:
47+
- apply:
48+
file: 06-dashboard.yaml
49+
- assert:
50+
file: 06-assert.yaml
51+
- name: step-07
52+
try:
53+
- apply:
54+
file: 07-jsonnet-project.yaml
55+
- assert:
56+
file: 07-assert.yaml

0 commit comments

Comments
 (0)