Skip to content

Commit

Permalink
chore: migrate from kuttl to chainsaw
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 16, 2024
1 parent 4f4a534 commit dbdf6f8
Show file tree
Hide file tree
Showing 24 changed files with 207 additions and 204 deletions.
12 changes: 12 additions & 0 deletions e2e/.chainsaw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Configuration
metadata:
name: configuration
spec:
timeouts:
assert: 5m0s
cleanup: 5m0s
delete: 5m0s
error: 5m0s
exec: 5m0s
4 changes: 2 additions & 2 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ _runThisTest:
cp $(ROOT_DIR)/e2e/Makefile $$D ;\
mkdir $$D/suit ;\
cp -r $(PWD) $$D/suit ;\
ROOT_DIR=$(ROOT_DIR) KUBECONFIG="$(ROOT_DIR)/kubeconfig" kubectl-kuttl test --timeout 300 --skip-delete "$$D/suit"
ROOT_DIR=$(ROOT_DIR) KUBECONFIG="$(ROOT_DIR)/kubeconfig" chainsaw test --skip-delete "$$D/suit"

runTestSuit:
@T="$$(KUBECONFIG="$$ROOT_DIR/kubeconfig" kubectl-kuttl test --timeout 300 --skip-delete --namespace "$$NAMESPACE" "$$TS" 2>&1)" ;\
@T="$$(KUBECONFIG="$$ROOT_DIR/kubeconfig" chainsaw test --skip-delete --namespace "$$NAMESPACE" "$$TS" 2>&1)" ;\
echo "$$T" |\
grep -v harness.go |\
grep -v ^=== |\
Expand Down
89 changes: 0 additions & 89 deletions e2e/README.MD

This file was deleted.

7 changes: 0 additions & 7 deletions e2e/kuttl-config.yaml

This file was deleted.

This file was deleted.

17 changes: 11 additions & 6 deletions e2e/linodecluster-controller/minimal/02-create-linodecluster.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
CLUSTER_UID="$(OBJ=clusters/cluster-sample make getKubeUid)" \
TS="$(TPL="$PWD/02-create-linodecluster.tpl.yml" make renderTestCase)" make runTestSuit
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeCluster
metadata:
name: linodecluster-sample
ownerReferences:
- apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
name: cluster-sample
uid: (x_k8s_get($client, 'cluster.x-k8s.io/v1beta1', 'Cluster', $namespace, 'cluster-sample').metadata.uid)
spec:
region: us-sea

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions e2e/linodecluster-controller/minimal/06-cleanup-cluster.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions e2e/linodecluster-controller/minimal/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: minimal
spec:
steps:
- name: step-00
try:
- assert:
file: 00-assert.yaml
- name: step-01
try:
- apply:
file: 01-create-cluster.yaml
- name: step-02
try:
- apply:
file: 02-create-linodecluster.yaml
- assert:
file: 02-assert.yaml
- name: step-03
try:
- script:
content: 'URI="nodebalancers" FILTER="{\"tags\":\"$(OBJ=linodeclusters/linodecluster-sample
make getKubeUid)\"}" make callLinodeApiGet | grep ''results": 1'''
- name: step-04
try:
- delete:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeCluster
name: linodecluster-sample
- error:
file: 04-error.yaml
- name: step-05
try:
- script:
content: 'URI="nodebalancers" FILTER="{\"tags\":\"$(OBJ=linodeclusters/linodecluster-sample
make getKubeUid)\"}" make callLinodeApiGet | grep ''results": 0'''
11 changes: 0 additions & 11 deletions e2e/linodemachine-controller/byovpc/01-create-cluster.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

60 changes: 60 additions & 0 deletions e2e/linodemachine-controller/byovpc/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: byovpc
spec:
steps:
- name: step-00
try:
- assert:
file: 00-assert.yaml
- name: step-01
try:
- command:
args:
- createVPC
entrypoint: make
- script:
content: |-
VPC_ID=$(make fetchVPCID) \
TS="$(TPL="$PWD/01-create-vpc.tpl.yml" make renderTestCase)" make runTestSuit
- command:
args:
- enableVPC
entrypoint: make
- script:
content: |-
VPC_UID="$(OBJ=linodevpcs/linodevpc-sample make getKubeUid)" \
TS="$(TPL="$PWD/01-create-cluster.tpl.yml" make renderTestCase)" make runTestSuit
- apply:
file: 01-create-cluster.tpl.yml
- apply:
file: 01-create-vpc.tpl.yml
- assert:
file: 01-assert.yaml
- name: step-02
try:
- script:
content: |-
MACHINE_UID="$(OBJ=machines/machine-sample make getKubeUid)" \
TS="$(TPL="$PWD/02-create-linodemachine.tpl.yml" make renderTestCase)" make runTestSuit
- apply:
file: 02-create-linodemachine.tpl.yml
- assert:
file: 02-assert.yaml
- name: step-03
try:
- delete:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeMachine
name: linodemachine-sample
- error:
file: 03-error.yaml
- name: step-04
try:
- script:
content: 'URI="linode/instances" FILTER="{\"tags\":\"$(OBJ=linodemachines/linodemachine-sample
make getKubeUid)\"}" make callLinodeApiGet | grep ''results": 0'''

This file was deleted.

18 changes: 12 additions & 6 deletions e2e/linodemachine-controller/minimal/02-create-linodemachine.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
MACHINE_UID="$(OBJ=machines/machine-sample make getKubeUid)" \
TS="$(TPL="$PWD/02-create-linodemachine.tpl.yml" make renderTestCase)" make runTestSuit
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeMachine
metadata:
ownerReferences:
- apiVersion: cluster.x-k8s.io/v1beta1
kind: Machine
name: machine-sample
uid: (x_k8s_get($client, 'cluster.x-k8s.io/v1beta1', 'Machine', $namespace, 'machine-sample').metadata.uid)
name: linodemachine-sample
spec:
region: us-sea
type: g5-nanode-1

This file was deleted.

This file was deleted.

36 changes: 36 additions & 0 deletions e2e/linodemachine-controller/minimal/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: minimal
spec:
steps:
- name: step-00
try:
- assert:
file: 00-assert.yaml
- name: step-01
try:
- apply:
file: 01-create-cluster.yaml
- name: step-02
try:
- apply:
file: 02-create-linodemachine.tpl.yml
- assert:
file: 02-assert.yaml
- name: step-03
try:
- delete:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeMachine
name: linodemachine-sample
- error:
file: 03-error.yaml
- name: step-04
try:
- script:
content: 'URI="linode/instances" FILTER="{\"tags\":\"$(OBJ=linodemachines/linodemachine-sample
make getKubeUid)\"}" make callLinodeApiGet | grep ''results": 0'''
Loading

0 comments on commit dbdf6f8

Please sign in to comment.