Skip to content

Commit

Permalink
e2e: Basic test for cluster controller (#99)
Browse files Browse the repository at this point in the history
* e2e: Basic test for cluster controller

* e2e: Add step to clean up cluster

* e2e: Add step to verify nodebalancer creation
  • Loading branch information
bcm820 authored Feb 9, 2024
1 parent 2534d78 commit ea58647
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 0 deletions.
7 changes: 7 additions & 0 deletions e2e/linodecluster-controller/minimal/01-create-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: cluster-sample
spec:
infrastructureRef:
name: linodecluster-sample
10 changes: 10 additions & 0 deletions e2e/linodecluster-controller/minimal/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeCluster
metadata:
name: linodecluster-sample
finalizers:
- infrastructure.cluster.x-k8s.io/v1alpha1
spec:
region: us-sea
status:
ready: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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: ${CLUSTER_UID}
spec:
region: us-sea
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
URI="nodebalancers" FILTER="{\"tags\":\"$(OBJ=linodeclusters/linodecluster-sample make getKubeUid)\"}" make callLinodeApiGet | grep 'results": 1'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeCluster
name: linodecluster-sample
4 changes: 4 additions & 0 deletions e2e/linodecluster-controller/minimal/04-error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeCluster
metadata:
name: linodecluster-sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
URI="nodebalancers" FILTER="{\"tags\":\"$(OBJ=linodeclusters/linodecluster-sample make getKubeUid)\"}" make callLinodeApiGet | grep 'results": 0'
5 changes: 5 additions & 0 deletions e2e/linodecluster-controller/minimal/06-cleanup-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: cluster-sample
spec:
1 change: 1 addition & 0 deletions e2e/linodecluster-controller/minimal/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile

0 comments on commit ea58647

Please sign in to comment.