Skip to content

Commit

Permalink
add kuttl test demo (#263)
Browse files Browse the repository at this point in the history
add 00-deploy 01-update

add 02-delete

add make target for test-e2e and move test manifests to testing, remove tests dir

Added e2e_setup script

Added clusterctl command to generate manifests

Changed basecluster repo path

Added e2e teardown script

Co-authored-by: Ubuntu <ubuntu@ip-172-31-25-241.us-west-2.compute.internal>
  • Loading branch information
Rohitrajak1807 and Ubuntu authored Oct 14, 2022
1 parent eb3da38 commit 7ec6274
Show file tree
Hide file tree
Showing 15 changed files with 449 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ __debug_bin
*~
arlon

# kuttl artifacts
kubeconfig
kind-logs-*
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,10 @@ endef

pkgtest:
go test -v ./pkg/...

test-e2e:
./testing/e2e_setup.sh
kubectl kuttl test --start-kind=false ./testing/e2e/ --test 00-deploy
kubectl kuttl test --start-kind=false ./testing/e2e/ --test 01-update
kubectl kuttl test --start-kind=false ./testing/e2e/ --test 02-delete
./testing/e2e_setup_teardown.sh
4 changes: 4 additions & 0 deletions testing/e2e/00-deploy/00-prepare.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: arlon basecluster preparegit --repo-url http://172.17.0.1:8188/myrepo.git --repo-path basecluster/test-cluster1
4 changes: 4 additions & 0 deletions testing/e2e/00-deploy/01-validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: arlon basecluster validategit --repo-url http://172.17.0.1:8188/myrepo.git --repo-path basecluster/test-cluster1
26 changes: 26 additions & 0 deletions testing/e2e/00-deploy/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 1800
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
namespace: test-cluster1
status:
controlPlaneReady: true
infrastructureReady: true
phase: Provisioned
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
namespace: test-cluster1
status:
phase: Running
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: AWSManagedControlPlane
metadata:
namespace: test-cluster1
status:
ready: true
4 changes: 4 additions & 0 deletions testing/e2e/00-deploy/02-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: arlon cluster create --cluster-name test-cluster1 --repo-url http://172.17.0.1:8188/myrepo.git --repo-path basecluster/test-cluster1
10 changes: 10 additions & 0 deletions testing/e2e/01-update/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 60
---
apiVersion: v1
kind: Secret
metadata:
namespace: arlon
name: xenial

4 changes: 4 additions & 0 deletions testing/e2e/01-update/00-bundlecreate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: arlon bundle create xenial --tags test,xenial --desc "Xenial pod" --repo-url http://172.17.0.1:8188/myrepo.git --repo-path bundles/xenial
8 changes: 8 additions & 0 deletions testing/e2e/01-update/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: core.arlon.io/v1
kind: Profile
metadata:
namespace: arlon
name: dynamic-1
spec:
bundles:
- xenial
4 changes: 4 additions & 0 deletions testing/e2e/01-update/01-profile-create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: arlon profile create dynamic-1 --repo-url http://172.17.0.1:8188/myrepo.git --repo-base-path profiles --bundles xenial --desc "dynamic test 1" --tags examples
17 changes: 17 additions & 0 deletions testing/e2e/01-update/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 150
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
labels:
arlon-cluster: test-cluster1
arlon-profile: dynamic-1
arlon-type: profile-app
managed-by: arlon
namespace: argocd
name: test-cluster1-profile-dynamic-1
status:
health:
status: Healthy
4 changes: 4 additions & 0 deletions testing/e2e/01-update/02-ngupdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: arlon cluster ngupdate test-cluster1 --profile dynamic-1
6 changes: 6 additions & 0 deletions testing/e2e/02-delete/00-delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: arlon cluster delete test-cluster1
- command: arlon bundle delete xenial
- command: arlon profile delete dynamic-1
Loading

0 comments on commit 7ec6274

Please sign in to comment.