Skip to content

Commit

Permalink
Add kuttle test for cell deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkisaolamb committed Sep 2, 2024
1 parent b242112 commit 8d09b32
Show file tree
Hide file tree
Showing 7 changed files with 309 additions and 1 deletion.
2 changes: 1 addition & 1 deletion templates/nova-manage/config/cell-delete-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"command": "/bin/ensure_cell_mapping.sh",
"command": "/bin/delete_cell.sh",
"config_files": [
{
"source": "/var/lib/openstack/config/nova-blank.conf",
Expand Down
140 changes: 140 additions & 0 deletions test/kuttl/test-suites/default/cell-delete-tests/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
apiVersion: nova.openstack.org/v1beta1
kind: Nova
metadata:
finalizers:
- openstack.org/nova
name: nova-kuttl
namespace: nova-kuttl-default
status:
apiServiceReadyCount: 1
metadataServiceReadyCount: 1
schedulerServiceReadyCount: 1
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: Input data complete
reason: Ready
status: "True"
type: InputReady
- message: Setup complete
reason: Ready
status: "True"
type: KeystoneServiceReady
- message: MariaDBAccount creation complete
reason: Ready
status: "True"
type: MariaDBAccountReady
- message: ' Memcached instance has been provisioned'
reason: Ready
status: "True"
type: MemcachedReady
- message: DB create completed
reason: Ready
status: "True"
type: NovaAPIDBReady
- message: API message bus creation successfully
reason: Ready
status: "True"
type: NovaAPIMQReady
- message: Setup complete
reason: Ready
status: "True"
type: NovaAPIReady
- message: All DBs created successfully
reason: Ready
status: "True"
type: NovaAllCellDBReady
- message: All NovaCells are ready
reason: Ready
status: "True"
type: NovaAllCellReady
- message: All message busses created successfully
reason: Ready
status: "True"
type: NovaAllCellsMQReady
- message: Setup complete
reason: Ready
status: "True"
type: NovaMetadataReady
- message: Setup complete
reason: Ready
status: "True"
type: NovaSchedulerReady
- message: RoleBinding created
reason: Ready
status: "True"
type: RoleBindingReady
- message: Role created
reason: Ready
status: "True"
type: RoleReady
- message: ServiceAccount created
reason: Ready
status: "True"
type: ServiceAccountReady
---
apiVersion: v1
kind: Pod
metadata:
annotations:
openshift.io/scc: anyuid
labels:
service: nova-api
name: nova-kuttl-api-0
status:
containerStatuses:
- name: nova-kuttl-api-api
ready: true
started: true
- name: nova-kuttl-api-log
ready: true
started: true
---
apiVersion: v1
kind: Pod
metadata:
annotations:
openshift.io/scc: anyuid
labels:
service: nova-metadata
statefulset.kubernetes.io/pod-name: nova-kuttl-metadata-0
name: nova-kuttl-metadata-0
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: StatefulSet
name: nova-kuttl-metadata
status:
containerStatuses:
- name: nova-kuttl-metadata-log
ready: true
started: true
- name: nova-kuttl-metadata-metadata
ready: true
started: true
---
apiVersion: v1
kind: Pod
metadata:
name: nova-kuttl-cell1-compute-fake1-compute-0
status:
containerStatuses:
- name: nova-kuttl-cell1-compute-fake1-compute-compute
ready: true
started: true
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
namespaced: true
commands:
- script: |
set -euxo pipefail
MESSAGE=$(oc exec -n $NAMESPACE openstackclient -- openstack flavor create my-flavor 2>&1) || true
echo $MESSAGE | grep "Policy doesn't allow os_compute_api:os-flavor-manage:create to be performed"
- script: |
set -euxo pipefail
RP_UUID=$(oc exec -n $NAMESPACE openstackclient -- openstack resource provider list --name nova-kuttl-cell1-compute-fake1-compute-0 -f value -c uuid)
oc exec -n $NAMESPACE openstackclient -- openstack resource provider trait list $RP_UUID | grep CUSTOM_FOO
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: nova.openstack.org/v1beta1
kind: Nova
metadata:
name: nova-kuttl
spec:
secret: osp-secret
cellTemplates:
cell0:
cellDatabaseInstance: openstack
cellDatabaseAccount: nova-cell0
cellMessageBusInstance: rabbitmq
hasAPIAccess: true
memcachedInstance: memcached
cell1:
cellDatabaseInstance: openstack-cell1
cellDatabaseAccount: nova-cell1
cellMessageBusInstance: rabbitmq-cell1
memcachedInstance: memcached
novaComputeTemplates:
compute-fake1:
computeDriver: fake.FakeDriver
defaultConfigOverwrite:
provider.yaml: |
meta:
schema_version: '1.0'
providers:
- identification:
uuid: '$COMPUTE_NODE'
traits:
additional:
- 'CUSTOM_FOO'
130 changes: 130 additions & 0 deletions test/kuttl/test-suites/default/cell-delete-tests/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
apiVersion: nova.openstack.org/v1beta1
kind: Nova
metadata:
finalizers:
- openstack.org/nova
name: nova-kuttl
namespace: nova-kuttl-default
status:
apiServiceReadyCount: 1
metadataServiceReadyCount: 1
schedulerServiceReadyCount: 1
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: Input data complete
reason: Ready
status: "True"
type: InputReady
- message: Setup complete
reason: Ready
status: "True"
type: KeystoneServiceReady
- message: MariaDBAccount creation complete
reason: Ready
status: "True"
type: MariaDBAccountReady
- message: ' Memcached instance has been provisioned'
reason: Ready
status: "True"
type: MemcachedReady
- message: DB create completed
reason: Ready
status: "True"
type: NovaAPIDBReady
- message: API message bus creation successfully
reason: Ready
status: "True"
type: NovaAPIMQReady
- message: Setup complete
reason: Ready
status: "True"
type: NovaAPIReady
- message: All DBs created successfully
reason: Ready
status: "True"
type: NovaAllCellDBReady
- message: All NovaCells are ready
reason: Ready
status: "True"
type: NovaAllCellReady
- message: All message busses created successfully
reason: Ready
status: "True"
type: NovaAllCellsMQReady
- message: Setup complete
reason: Ready
status: "True"
type: NovaMetadataReady
- message: Setup complete
reason: Ready
status: "True"
type: NovaSchedulerReady
- message: RoleBinding created
reason: Ready
status: "True"
type: RoleBindingReady
- message: Role created
reason: Ready
status: "True"
type: RoleReady
- message: ServiceAccount created
reason: Ready
status: "True"
type: ServiceAccountReady
---
apiVersion: v1
kind: Pod
metadata:
annotations:
openshift.io/scc: anyuid
labels:
service: nova-api
name: nova-kuttl-api-0
status:
containerStatuses:
- name: nova-kuttl-api-api
ready: true
started: true
- name: nova-kuttl-api-log
ready: true
started: true
---
apiVersion: v1
kind: Pod
metadata:
annotations:
openshift.io/scc: anyuid
labels:
service: nova-metadata
statefulset.kubernetes.io/pod-name: nova-kuttl-metadata-0
name: nova-kuttl-metadata-0
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: StatefulSet
name: nova-kuttl-metadata
status:
containerStatuses:
- name: nova-kuttl-metadata-log
ready: true
started: true
- name: nova-kuttl-metadata-metadata
ready: true
started: true
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
namespaced: true
commands:
- script: |
set -euxo pipefail
MESSAGE=$(oc exec -n $NAMESPACE openstackclient -- openstack flavor create my-flavor 2>&1) || true
echo $MESSAGE | grep "Policy doesn't allow os_compute_api:os-flavor-manage:create to be performed"
- script: |
set -euxo pipefail
RP_UUID=$(oc exec -n $NAMESPACE openstackclient -- openstack resource provider list --name nova-kuttl-cell1-compute-fake1-compute-0 -f value -c uuid)
oc exec -n $NAMESPACE openstackclient -- openstack resource provider trait list $RP_UUID | grep CUSTOM_FOO
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc patch -n nova-kuttl-default nova/nova-kuttl --type='json' -p='[{"op": "remove", "path": "/spec/cellTemplates/cell1"}]'

0 comments on commit 8d09b32

Please sign in to comment.