Skip to content

Commit

Permalink
Rename KUTTL tests dir to fix the tests on install_yamls
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauricio Harley committed Dec 15, 2023
1 parent 3b1359a commit f991053
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 0 deletions.
51 changes: 51 additions & 0 deletions tests/kuttl/common/assert_sample_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: barbican.openstack.org/v1beta1
kind: Barbican
metadata:
name: barbican
spec:
serviceUser: barbican
customServiceConfig: |
[DEFAULT]
debug = True
databaseInstance: openstack
databaseUser: barbican
rabbitMqClusterName: rabbitmq
barbicanAPI:
replicas: 1
barbicanWorker:
replicas: 1
barbicanKeystoneListener:
replicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-api-api
ownerReferences:
- apiVersion: barbican.openstack.org/v1beta1
blockOwnerDeletion: true
controller: true
kind: BarbicanAPI
name: barbican-api
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-keystone-listener-keystone-listener
ownerReferences:
- apiVersion: barbican.openstack.org/v1beta1
blockOwnerDeletion: true
controller: true
kind: BarbicanKeystoneListener
name: barbican-keystone-listener
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-worker-worker
ownerReferences:
- apiVersion: barbican.openstack.org/v1beta1
blockOwnerDeletion: true
controller: true
kind: BarbicanWorker
name: barbican-worker
1 change: 1 addition & 0 deletions tests/kuttl/tests/barbican_scale/01-assert.yaml
6 changes: 6 additions & 0 deletions tests/kuttl/tests/barbican_scale/01-deploy-barbican.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
cp ../../../../config/samples/barbican_v1beta1_barbican.*yaml deploy
oc kustomize deploy | oc apply -n $NAMESPACE -f -
49 changes: 49 additions & 0 deletions tests/kuttl/tests/barbican_scale/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Check for:
# - Barbican CRs with 2 replicas for each one
# - BarbicanAPI barbican-api Deployment with 2 replicas
# - BarbicanKeystoneListener barbican-keystone-listener Deployment with 2 replicas
# - BarbicanWorker barbican-worker Deployment with 2 replicas


apiVersion: barbican.openstack.org/v1beta1
kind: Barbican
metadata:
name: barbican
spec:
barbicanAPI:
replicas: 2
barbicanKeystoneListener:
replicas: 2
barbicanWorker:
replicas: 2
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-api-api
spec:
replicas: 2
status:
availableReplicas: 2
replicas: 2
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-keystone-listener-keystone-listener
spec:
replicas: 2
status:
availableReplicas: 2
replicas: 2
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-worker-worker
spec:
replicas: 2
status:
availableReplicas: 2
replicas: 2
7 changes: 7 additions & 0 deletions tests/kuttl/tests/barbican_scale/02-scale-barbican.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanAPI/replicas", "value":2}]'
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanKeystoneListener/replicas", "value":2}]'
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanWorker/replicas", "value":2}]'
49 changes: 49 additions & 0 deletions tests/kuttl/tests/barbican_scale/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Check for:
# - Barbican CRs with12 replicas for each one
# - BarbicanAPI barbican-api Deployment with 1 replica
# - BarbicanKeystoneListener barbican-keystone-listener Deployment with 1 replica
# - BarbicanWorker barbican-worker Deployment with 1 replica


apiVersion: barbican.openstack.org/v1beta1
kind: Barbican
metadata:
name: barbican
spec:
barbicanAPI:
replicas: 1
barbicanKeystoneListener:
replicas: 1
barbicanWorker:
replicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-api-api
spec:
replicas: 1
status:
availableReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-keystone-listener-keystone-listener
spec:
replicas: 1
status:
availableReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-worker-worker
spec:
replicas: 1
status:
availableReplicas: 1
replicas: 1
7 changes: 7 additions & 0 deletions tests/kuttl/tests/barbican_scale/03-scale-down-barbican.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanAPI/replicas", "value":1}]'
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanKeystoneListener/replicas", "value":1}]'
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanWorker/replicas", "value":1}]'
40 changes: 40 additions & 0 deletions tests/kuttl/tests/barbican_scale/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Check for:
# - Barbican CRs with 0 replicas for each one
# - BarbicanAPI barbican-api Deployment with 0 replicas
# - BarbicanKeystoneListener barbican-keystone-listener Deployment with 0 replicas
# - BarbicanWorker barbican-worker Deployment with 0 replicas


apiVersion: barbican.openstack.org/v1beta1
kind: Barbican
metadata:
name: barbican
spec:
barbicanAPI:
replicas: 0
barbicanKeystoneListener:
replicas: 0
barbicanWorker:
replicas: 0
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-api-api
spec:
replicas: 0
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-keystone-listener-keystone-listener
spec:
replicas: 0
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican-worker-worker
spec:
replicas: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanAPI/replicas", "value":0}]'
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanKeystoneListener/replicas", "value":0}]'
oc patch Barbican -n $NAMESPACE barbican --type='json' -p='[{"op": "replace", "path": "/spec/barbicanWorker/replicas", "value":0}]'
6 changes: 6 additions & 0 deletions tests/kuttl/tests/barbican_scale/05-cleanup-barbican.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc kustomize deploy | oc delete -n $NAMESPACE -f -
rm deploy/barbican_v1beta1_barbican.yaml
17 changes: 17 additions & 0 deletions tests/kuttl/tests/barbican_scale/05-errors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Check for:
#
# No BarbicanAPI CR
# No Deployment for BarbicanAPI CR
# No Pods in barbican Deployment
# No Barbican Services
#
apiVersion: barbican.openstack.org/v1beta1
kind: Barbican
metadata:
name: barbican
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: barbican
13 changes: 13 additions & 0 deletions tests/kuttl/tests/barbican_scale/deploy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./barbican_v1beta1_barbican.yaml
patches:
- patch: |-
- op: replace
path: /spec/secret
value: osp-secret
- op: replace
path: /metadata/namespace
target:
kind: Barbican

0 comments on commit f991053

Please sign in to comment.