Skip to content

Commit

Permalink
Including KUTTL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauricio Harley authored and dmendiza committed Dec 7, 2023
1 parent bc0b60e commit 3b1359a
Show file tree
Hide file tree
Showing 15 changed files with 190 additions and 208 deletions.
1 change: 0 additions & 1 deletion config/samples/barbican_v1beta1_barbican.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ spec:
optional_policy.json: |
{"some": "custom policy"}
barbicanKeystoneListener:
containerImage: quay.io/podified-antelope-centos9/openstack-barbican-keystone-listener:current-podified
nodeSelector:
optional_override: here
customServiceConfig: |
Expand Down
4 changes: 2 additions & 2 deletions kuttl-test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# EXECUTION (from install_yamls repo root):
#
# make cinder_kuttl
# make barbican_kuttl
#
# ASSUMPTIONS:
#
Expand All @@ -18,7 +18,7 @@ apiVersion: kuttl.dev/v1beta1
kind: TestSuite
reportFormat: JSON
reportName: kuttl-test-barbican
namespace: barbican-kuttl-tests
namespace: barbican-kuttl-tests
timeout: 180
parallel: 1
suppress:
Expand Down
94 changes: 29 additions & 65 deletions test/kuttl/common/assert_sample_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,68 +20,32 @@ spec:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: barbican
app.kubernetes.io/instance: barbican
app.kubernetes.io/part-of: barbican-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: barbican-operator
name: barbican
spec:
serviceAccount: barbican
serviceUser: barbican
containerImage: quay.io/podified-antelope-centos9/openstack-barbican-api:current-podified
databaseInstance: openstack
databaseUser: barbican
rabbitMqCusterName: barbican_rabbit
secret: osp-secret
passwordSelectors:
database: BarbicanDatabasePassword
service: BarbicanPassword
debug:
dbInitContainer: false
dbSync: false
initContainer: false
service: false
preserveJobs: true
nodeSelector:
node: controller
customServiceConfig: |
[DEFAULT]
debug = True
defaultConfigOverwrite:
policy.json: |
{"some": "custom policy"}
barbicanAPI:
containerImage: quay.io/podified-antelope-centos9/openstack-barbican-api:current-podified
nodeSelector:
optional_override: here
customServiceConfig: |
[optional]
overrides = True
defautlConfigOverwrite:
optional_policy.json: |
{"some": "custom policy"}
passwordSelectors:
database: BarbicanDatabasePassword
service: BarbicanPassword
barbicanWorker:
containerImage: quay.io/podified-antelope-centos9/openstack-barbican-worker:current-podified
nodeSelector:
optional_override: here
customServiceConfig: |
[optional]
overrides = True
defautlConfigOverwrite:
optional_policy.json: |
{"some": "custom policy"}
barbicanKeystoneListener:
containerImage: quay.io/podified-antelope-centos9/openstack-barbican-keystone-listener:current-podified
nodeSelector:
optional_override: here
customServiceConfig: |
[optional]
overrides = True
defautlConfigOverwrite:
optional_policy.json: |
{"some": "custom policy"}
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
49 changes: 49 additions & 0 deletions test/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 test/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 test/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 test/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 test/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}]'

This file was deleted.

Loading

0 comments on commit 3b1359a

Please sign in to comment.