From 62bba8b5aba06a3625dde86a265f9eb758452ba8 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Tue, 4 Feb 2025 17:30:01 +0100 Subject: [PATCH] Refactoring kuttl tests for better execution Kuttl tests are currently hard to follow, because we literally assert the entire resources associated to a Manila deployment. This patch aims to produce a big refactoring of the current kuttl testing, to achieve the following results: 1. Only match, within the deployed resources, what is meaningful to make the test fail or pass 2. Reorganize kuttl tests in test suites, so we don't have to specify the testDirs via cli but they live within the main kutt-test.yaml config file Signed-off-by: Francesco Pantano --- kuttl-test.yaml | 4 + test/kuttl/tests/manila-basic/01-assert.yaml | 193 ----------------- test/kuttl/tests/manila-basic/03-assert.yaml | 193 ----------------- test/kuttl/tests/manila-basic/04-assert.yaml | 194 ------------------ test/kuttl/tests/manila-basic/config.yaml | 13 ++ .../tests/manila-basic/tests/01-assert.yaml | 103 ++++++++++ .../{ => tests}/01-deploy-manila.yaml | 0 .../manila-basic/{ => tests}/02-assert.yaml | 51 ----- .../{ => tests}/02-scale-up-manila.yaml | 0 .../tests/manila-basic/tests/03-assert.yaml | 103 ++++++++++ .../{ => tests}/03-scale-down-manila-api.yaml | 0 .../tests/manila-basic/tests/04-assert.yaml | 103 ++++++++++ .../04-scale-up-manila-scheduler.yaml | 0 .../{ => tests}/99-cleanup-manila.yaml | 0 .../manila-basic/{ => tests}/99-errors.yaml | 0 .../tests/manila-multibackend/config.yaml | 13 ++ .../{ => tests}/01-assert.yaml | 101 --------- .../{ => tests}/01-deploy-manila.yaml | 0 .../{ => tests}/02-assert.yaml | 71 ------- .../{ => tests}/02-scale-up-manila-share.yaml | 0 .../{ => tests}/03-assert.yaml | 102 --------- .../03-scale-down-manila-share.yaml | 0 .../{ => tests}/04-assert.yaml | 100 --------- .../{ => tests}/04-remove-share.yaml | 0 .../{ => tests}/05-cleanup-manila.yaml | 0 .../{ => tests}/05-errors.yaml | 0 test/kuttl/tests/manila-tls/config.yaml | 13 ++ .../manila-tls/{ => tests}/01-assert.yaml | 0 .../{ => tests}/01-tls_certificates.yaml | 0 .../{ => tests}/02-manila-deploy.yaml | 0 .../manila-tls/{ => tests}/03-assert.yaml | 84 -------- .../{ => tests}/04-cleanup-manila.yaml | 0 32 files changed, 352 insertions(+), 1089 deletions(-) delete mode 100644 test/kuttl/tests/manila-basic/01-assert.yaml delete mode 100644 test/kuttl/tests/manila-basic/03-assert.yaml delete mode 100644 test/kuttl/tests/manila-basic/04-assert.yaml create mode 100644 test/kuttl/tests/manila-basic/config.yaml create mode 100644 test/kuttl/tests/manila-basic/tests/01-assert.yaml rename test/kuttl/tests/manila-basic/{ => tests}/01-deploy-manila.yaml (100%) rename test/kuttl/tests/manila-basic/{ => tests}/02-assert.yaml (69%) rename test/kuttl/tests/manila-basic/{ => tests}/02-scale-up-manila.yaml (100%) create mode 100644 test/kuttl/tests/manila-basic/tests/03-assert.yaml rename test/kuttl/tests/manila-basic/{ => tests}/03-scale-down-manila-api.yaml (100%) create mode 100644 test/kuttl/tests/manila-basic/tests/04-assert.yaml rename test/kuttl/tests/manila-basic/{ => tests}/04-scale-up-manila-scheduler.yaml (100%) rename test/kuttl/tests/manila-basic/{ => tests}/99-cleanup-manila.yaml (100%) rename test/kuttl/tests/manila-basic/{ => tests}/99-errors.yaml (100%) create mode 100644 test/kuttl/tests/manila-multibackend/config.yaml rename test/kuttl/tests/manila-multibackend/{ => tests}/01-assert.yaml (53%) rename test/kuttl/tests/manila-multibackend/{ => tests}/01-deploy-manila.yaml (100%) rename test/kuttl/tests/manila-multibackend/{ => tests}/02-assert.yaml (73%) rename test/kuttl/tests/manila-multibackend/{ => tests}/02-scale-up-manila-share.yaml (100%) rename test/kuttl/tests/manila-multibackend/{ => tests}/03-assert.yaml (53%) rename test/kuttl/tests/manila-multibackend/{ => tests}/03-scale-down-manila-share.yaml (100%) rename test/kuttl/tests/manila-multibackend/{ => tests}/04-assert.yaml (50%) rename test/kuttl/tests/manila-multibackend/{ => tests}/04-remove-share.yaml (100%) rename test/kuttl/tests/manila-multibackend/{ => tests}/05-cleanup-manila.yaml (100%) rename test/kuttl/tests/manila-multibackend/{ => tests}/05-errors.yaml (100%) create mode 100644 test/kuttl/tests/manila-tls/config.yaml rename test/kuttl/tests/manila-tls/{ => tests}/01-assert.yaml (100%) rename test/kuttl/tests/manila-tls/{ => tests}/01-tls_certificates.yaml (100%) rename test/kuttl/tests/manila-tls/{ => tests}/02-manila-deploy.yaml (100%) rename test/kuttl/tests/manila-tls/{ => tests}/03-assert.yaml (85%) rename test/kuttl/tests/manila-tls/{ => tests}/04-cleanup-manila.yaml (100%) diff --git a/kuttl-test.yaml b/kuttl-test.yaml index 58088a4e..06ba7906 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -22,5 +22,9 @@ reportGranularity: test namespace: manila-kuttl-tests timeout: 300 parallel: 1 +testDirs: + - test/kuttl/tests/manila-basic + - test/kuttl/tests/manila-multibackend + - test/kuttl/tests/manila-tls suppress: - events diff --git a/test/kuttl/tests/manila-basic/01-assert.yaml b/test/kuttl/tests/manila-basic/01-assert.yaml deleted file mode 100644 index 2550ae3f..00000000 --- a/test/kuttl/tests/manila-basic/01-assert.yaml +++ /dev/null @@ -1,193 +0,0 @@ -# -# Check for: -# -# - 1 manilaAPI -# - 2 manilaScheduler -# - 3 manilaShares -# - 4 extraMounts - -apiVersion: manila.openstack.org/v1beta1 -kind: Manila -metadata: - name: manila -spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols = cephfs - replicas: 1 - resources: {} - manilaScheduler: - customServiceConfig: '# add your customization here' - replicas: 1 - resources: {} - manilaShares: - share0: - replicas: 1 - resources: {} - customServiceConfig: | - [DEFAULT] - enabled_share_backends = cephfs - [cephfs] - driver_handles_share_servers=False - share_backend_name=cephfs - share_driver=manila.share.drivers.cephfs.driver.CephFSDriver - cephfs_conf_path=/etc/ceph/ceph.conf - cephfs_auth_id=openstack - cephfs_cluster_name=ceph - cephfs_protocol_helper_type=CEPHFS - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila -status: - conditions: - - message: Setup complete - reason: Ready - status: "True" - type: Ready - - message: CronJob completed - reason: Ready - status: "True" - type: CronJobReady - - message: DB create completed - reason: Ready - status: "True" - type: DBReady - - message: DBsync completed - reason: Ready - status: "True" - type: DBSyncReady - - message: Input data complete - reason: Ready - status: "True" - type: InputReady - - message: Setup complete - reason: Ready - status: "True" - type: ManilaAPIReady - - message: Setup complete - reason: Ready - status: "True" - type: ManilaSchedulerReady - - message: Deployment completed - reason: Ready - status: "True" - type: ManilaShareReady - - message: MariaDBAccount creation complete - reason: Ready - status: "True" - type: MariaDBAccountReady - - message: " Memcached instance has been provisioned" - reason: Ready - status: "True" - type: MemcachedReady - - message: NetworkAttachments completed - reason: Ready - status: "True" - type: NetworkAttachmentsReady - - message: RabbitMqTransportURL successfully created - reason: Ready - status: "True" - type: RabbitMqTransportURLReady - - 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 - - message: Service config create completed - reason: Ready - status: "True" - type: ServiceConfigReady - databaseHostname: openstack.manila-kuttl-tests.svc - manilaAPIReadyCount: 1 - manilaSchedulerReadyCount: 1 - manilaSharesReadyCounts: - share0: 1 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: manila-db-purge -spec: - jobTemplate: - metadata: - labels: - service: manila - spec: - completions: 1 - parallelism: 1 - template: - spec: - containers: - - args: - - -c - - /usr/bin/manila-manage --config-dir /etc/manila/manila.conf.d - db purge 30 - command: - - /bin/bash - name: manila-db-purge - volumeMounts: - - mountPath: /etc/manila/manila.conf.d - name: db-purge-config-data - readOnly: true - serviceAccount: manila-manila - serviceAccountName: manila-manila - volumes: - - name: db-purge-config-data - secret: - defaultMode: 420 - items: - - key: 00-config.conf - path: 00-config.conf - secretName: manila-config-data - schedule: 1 0 * * * - suspend: false ---- -# when using image digests the containerImage URLs are SHA's so we verify them with a script -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: - - script: | - tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' - imageTuples=$(oc get -n openstack-operators deployment manila-operator-controller-manager -o go-template="$tupleTemplate") - # format of imageTuple is: RELATED_IMAGE_MANILA_# separated by newlines - for ITEM in $(echo $imageTuples); do - # it is an image - if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then - NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_MANILA_\([^_]*\)_.*|\1|') - IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') - template='{{.spec.containerImage}}' - case $NAME in - API) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilaapi manila-api -o go-template="$template") - ;; - SHARE) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilashares manila-share-share0 -o go-template="$template") - ;; - SCHEDULER) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilascheduler manila-scheduler -o go-template="$template") - ;; - esac - if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then - echo "$NAME image does not equal $VALUE" - exit 1 - fi - fi - done - exit 0 diff --git a/test/kuttl/tests/manila-basic/03-assert.yaml b/test/kuttl/tests/manila-basic/03-assert.yaml deleted file mode 100644 index 2550ae3f..00000000 --- a/test/kuttl/tests/manila-basic/03-assert.yaml +++ /dev/null @@ -1,193 +0,0 @@ -# -# Check for: -# -# - 1 manilaAPI -# - 2 manilaScheduler -# - 3 manilaShares -# - 4 extraMounts - -apiVersion: manila.openstack.org/v1beta1 -kind: Manila -metadata: - name: manila -spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols = cephfs - replicas: 1 - resources: {} - manilaScheduler: - customServiceConfig: '# add your customization here' - replicas: 1 - resources: {} - manilaShares: - share0: - replicas: 1 - resources: {} - customServiceConfig: | - [DEFAULT] - enabled_share_backends = cephfs - [cephfs] - driver_handles_share_servers=False - share_backend_name=cephfs - share_driver=manila.share.drivers.cephfs.driver.CephFSDriver - cephfs_conf_path=/etc/ceph/ceph.conf - cephfs_auth_id=openstack - cephfs_cluster_name=ceph - cephfs_protocol_helper_type=CEPHFS - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila -status: - conditions: - - message: Setup complete - reason: Ready - status: "True" - type: Ready - - message: CronJob completed - reason: Ready - status: "True" - type: CronJobReady - - message: DB create completed - reason: Ready - status: "True" - type: DBReady - - message: DBsync completed - reason: Ready - status: "True" - type: DBSyncReady - - message: Input data complete - reason: Ready - status: "True" - type: InputReady - - message: Setup complete - reason: Ready - status: "True" - type: ManilaAPIReady - - message: Setup complete - reason: Ready - status: "True" - type: ManilaSchedulerReady - - message: Deployment completed - reason: Ready - status: "True" - type: ManilaShareReady - - message: MariaDBAccount creation complete - reason: Ready - status: "True" - type: MariaDBAccountReady - - message: " Memcached instance has been provisioned" - reason: Ready - status: "True" - type: MemcachedReady - - message: NetworkAttachments completed - reason: Ready - status: "True" - type: NetworkAttachmentsReady - - message: RabbitMqTransportURL successfully created - reason: Ready - status: "True" - type: RabbitMqTransportURLReady - - 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 - - message: Service config create completed - reason: Ready - status: "True" - type: ServiceConfigReady - databaseHostname: openstack.manila-kuttl-tests.svc - manilaAPIReadyCount: 1 - manilaSchedulerReadyCount: 1 - manilaSharesReadyCounts: - share0: 1 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: manila-db-purge -spec: - jobTemplate: - metadata: - labels: - service: manila - spec: - completions: 1 - parallelism: 1 - template: - spec: - containers: - - args: - - -c - - /usr/bin/manila-manage --config-dir /etc/manila/manila.conf.d - db purge 30 - command: - - /bin/bash - name: manila-db-purge - volumeMounts: - - mountPath: /etc/manila/manila.conf.d - name: db-purge-config-data - readOnly: true - serviceAccount: manila-manila - serviceAccountName: manila-manila - volumes: - - name: db-purge-config-data - secret: - defaultMode: 420 - items: - - key: 00-config.conf - path: 00-config.conf - secretName: manila-config-data - schedule: 1 0 * * * - suspend: false ---- -# when using image digests the containerImage URLs are SHA's so we verify them with a script -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: - - script: | - tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' - imageTuples=$(oc get -n openstack-operators deployment manila-operator-controller-manager -o go-template="$tupleTemplate") - # format of imageTuple is: RELATED_IMAGE_MANILA_# separated by newlines - for ITEM in $(echo $imageTuples); do - # it is an image - if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then - NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_MANILA_\([^_]*\)_.*|\1|') - IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') - template='{{.spec.containerImage}}' - case $NAME in - API) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilaapi manila-api -o go-template="$template") - ;; - SHARE) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilashares manila-share-share0 -o go-template="$template") - ;; - SCHEDULER) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilascheduler manila-scheduler -o go-template="$template") - ;; - esac - if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then - echo "$NAME image does not equal $VALUE" - exit 1 - fi - fi - done - exit 0 diff --git a/test/kuttl/tests/manila-basic/04-assert.yaml b/test/kuttl/tests/manila-basic/04-assert.yaml deleted file mode 100644 index 7c61c2a9..00000000 --- a/test/kuttl/tests/manila-basic/04-assert.yaml +++ /dev/null @@ -1,194 +0,0 @@ -# -# Check for: -# -# - 1 manilaAPI -# - 2 manilaScheduler -# - 3 manilaShares -# - 4 extraMounts - -apiVersion: manila.openstack.org/v1beta1 -kind: Manila -metadata: - name: manila -spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols = cephfs - replicas: 1 - resources: {} - manilaScheduler: - customServiceConfig: '# add your customization here' - replicas: 3 - resources: {} - manilaShares: - share0: - replicas: 1 - resources: {} - customServiceConfig: | - [DEFAULT] - enabled_share_backends = cephfs - [cephfs] - driver_handles_share_servers=False - share_backend_name=cephfs - share_driver=manila.share.drivers.cephfs.driver.CephFSDriver - cephfs_conf_path=/etc/ceph/ceph.conf - cephfs_auth_id=openstack - cephfs_cluster_name=ceph - cephfs_protocol_helper_type=CEPHFS - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila -status: - conditions: - - message: Setup complete - reason: Ready - status: "True" - type: Ready - - message: CronJob completed - reason: Ready - status: "True" - type: CronJobReady - - message: DB create completed - reason: Ready - status: "True" - type: DBReady - - message: DBsync completed - reason: Ready - status: "True" - type: DBSyncReady - - message: Input data complete - reason: Ready - status: "True" - type: InputReady - - message: Setup complete - reason: Ready - status: "True" - type: ManilaAPIReady - - message: Setup complete - reason: Ready - status: "True" - type: ManilaSchedulerReady - - message: Deployment completed - reason: Ready - status: "True" - type: ManilaShareReady - - message: MariaDBAccount creation complete - reason: Ready - status: "True" - type: MariaDBAccountReady - - message: " Memcached instance has been provisioned" - reason: Ready - status: "True" - type: MemcachedReady - - message: NetworkAttachments completed - reason: Ready - status: "True" - type: NetworkAttachmentsReady - - message: RabbitMqTransportURL successfully created - reason: Ready - status: "True" - type: RabbitMqTransportURLReady - - 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 - - message: Service config create completed - reason: Ready - status: "True" - type: ServiceConfigReady - databaseHostname: openstack.manila-kuttl-tests.svc - manilaAPIReadyCount: 1 - manilaSchedulerReadyCount: 3 - manilaSharesReadyCounts: - share0: 1 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: manila-db-purge -spec: - jobTemplate: - metadata: - labels: - service: manila - spec: - completions: 1 - parallelism: 1 - template: - spec: - containers: - - args: - - -c - - /usr/bin/manila-manage --config-dir /etc/manila/manila.conf.d - db purge 30 - command: - - /bin/bash - name: manila-db-purge - volumeMounts: - - mountPath: /etc/manila/manila.conf.d - name: db-purge-config-data - readOnly: true - serviceAccount: manila-manila - serviceAccountName: manila-manila - volumes: - - name: db-purge-config-data - secret: - defaultMode: 420 - items: - - key: 00-config.conf - path: 00-config.conf - secretName: manila-config-data - schedule: 1 0 * * * - suspend: false ---- -# when using image digests the containerImage URLs are SHA's so we verify them with a script -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: - - script: | - set -euxo pipefail - tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' - imageTuples=$(oc get -n openstack-operators deployment manila-operator-controller-manager -o go-template="$tupleTemplate") - # format of imageTuple is: RELATED_IMAGE_MANILA_# separated by newlines - for ITEM in $(echo $imageTuples); do - # it is an image - if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then - NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_MANILA_\([^_]*\)_.*|\1|') - IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') - template='{{.spec.containerImage}}' - case $NAME in - API) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilaapi manila-api -o go-template="$template") - ;; - SHARE) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilashares manila-share-share0 -o go-template="$template") - ;; - SCHEDULER) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilascheduler manila-scheduler -o go-template="$template") - ;; - esac - if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then - echo "$NAME image does not equal $VALUE" - exit 1 - fi - fi - done - exit 0 diff --git a/test/kuttl/tests/manila-basic/config.yaml b/test/kuttl/tests/manila-basic/config.yaml new file mode 100644 index 00000000..17b6b2d3 --- /dev/null +++ b/test/kuttl/tests/manila-basic/config.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestSuite +reportFormat: JSON +reportName: kuttl-manila-basic-results +namespace: manila-kuttl-tests +timeout: 300 +parallel: 1 +skipDelete: true +testDirs: + - test/kuttl/tests/manila-basic/tests +suppress: + - events +artifactsDir: tests/kuttl/tests/manila-basic/output diff --git a/test/kuttl/tests/manila-basic/tests/01-assert.yaml b/test/kuttl/tests/manila-basic/tests/01-assert.yaml new file mode 100644 index 00000000..e607b8ea --- /dev/null +++ b/test/kuttl/tests/manila-basic/tests/01-assert.yaml @@ -0,0 +1,103 @@ +# +# Check for: +# +# - 1 manilaAPI +# - 2 manilaScheduler +# - 3 manilaShares +# - 4 extraMounts + +apiVersion: manila.openstack.org/v1beta1 +kind: Manila +metadata: + name: manila +spec: + manilaShares: + share0: + replicas: 1 + resources: {} + customServiceConfig: | + [DEFAULT] + enabled_share_backends = cephfs + [cephfs] + driver_handles_share_servers=False + share_backend_name=cephfs + share_driver=manila.share.drivers.cephfs.driver.CephFSDriver + cephfs_conf_path=/etc/ceph/ceph.conf + cephfs_auth_id=openstack + cephfs_cluster_name=ceph + cephfs_protocol_helper_type=CEPHFS +status: + conditions: + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: CronJob completed + reason: Ready + status: "True" + type: CronJobReady + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: Setup complete + reason: Ready + status: "True" + type: ManilaAPIReady + - message: Setup complete + reason: Ready + status: "True" + type: ManilaSchedulerReady + - message: Deployment completed + reason: Ready + status: "True" + type: ManilaShareReady + - message: MariaDBAccount creation complete + reason: Ready + status: "True" + type: MariaDBAccountReady + - message: " Memcached instance has been provisioned" + reason: Ready + status: "True" + type: MemcachedReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - message: RabbitMqTransportURL successfully created + reason: Ready + status: "True" + type: RabbitMqTransportURLReady + - 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 + - message: Service config create completed + reason: Ready + status: "True" + type: ServiceConfigReady + manilaAPIReadyCount: 1 + manilaSchedulerReadyCount: 1 + manilaSharesReadyCounts: + share0: 1 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: manila-db-purge diff --git a/test/kuttl/tests/manila-basic/01-deploy-manila.yaml b/test/kuttl/tests/manila-basic/tests/01-deploy-manila.yaml similarity index 100% rename from test/kuttl/tests/manila-basic/01-deploy-manila.yaml rename to test/kuttl/tests/manila-basic/tests/01-deploy-manila.yaml diff --git a/test/kuttl/tests/manila-basic/02-assert.yaml b/test/kuttl/tests/manila-basic/tests/02-assert.yaml similarity index 69% rename from test/kuttl/tests/manila-basic/02-assert.yaml rename to test/kuttl/tests/manila-basic/tests/02-assert.yaml index 61eda78f..ab6fdbd1 100644 --- a/test/kuttl/tests/manila-basic/02-assert.yaml +++ b/test/kuttl/tests/manila-basic/tests/02-assert.yaml @@ -11,20 +11,6 @@ kind: Manila metadata: name: manila spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols = cephfs - replicas: 3 - resources: {} - manilaScheduler: - replicas: 1 - resources: {} manilaShares: share0: replicas: 1 @@ -40,12 +26,6 @@ spec: cephfs_auth_id=openstack cephfs_cluster_name=ceph cephfs_protocol_helper_type=CEPHFS - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila status: conditions: - message: Setup complete @@ -112,53 +92,22 @@ status: reason: Ready status: "True" type: ServiceConfigReady - databaseHostname: openstack.manila-kuttl-tests.svc manilaAPIReadyCount: 3 manilaSchedulerReadyCount: 1 manilaSharesReadyCounts: share0: 1 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport --- apiVersion: manila.openstack.org/v1beta1 kind: ManilaAPI metadata: - finalizers: - - openstack.org/manilaapi name: manila-api -spec: - databaseHostname: openstack.manila-kuttl-tests.svc - databaseAccount: manila - passwordSelectors: - service: ManilaPassword - replicas: 3 - resources: {} - secret: osp-secret - serviceAccount: manila-manila - serviceUser: manila status: readyCount: 3 --- apiVersion: apps/v1 kind: StatefulSet metadata: - labels: - component: manila-api - service: manila name: manila-api - ownerReferences: - - apiVersion: manila.openstack.org/v1beta1 - kind: ManilaAPI - name: manila-api -spec: - replicas: 3 - template: - metadata: - labels: - component: manila-api - service: manila - spec: - serviceAccount: manila-manila - serviceAccountName: manila-manila status: availableReplicas: 3 readyReplicas: 3 diff --git a/test/kuttl/tests/manila-basic/02-scale-up-manila.yaml b/test/kuttl/tests/manila-basic/tests/02-scale-up-manila.yaml similarity index 100% rename from test/kuttl/tests/manila-basic/02-scale-up-manila.yaml rename to test/kuttl/tests/manila-basic/tests/02-scale-up-manila.yaml diff --git a/test/kuttl/tests/manila-basic/tests/03-assert.yaml b/test/kuttl/tests/manila-basic/tests/03-assert.yaml new file mode 100644 index 00000000..e607b8ea --- /dev/null +++ b/test/kuttl/tests/manila-basic/tests/03-assert.yaml @@ -0,0 +1,103 @@ +# +# Check for: +# +# - 1 manilaAPI +# - 2 manilaScheduler +# - 3 manilaShares +# - 4 extraMounts + +apiVersion: manila.openstack.org/v1beta1 +kind: Manila +metadata: + name: manila +spec: + manilaShares: + share0: + replicas: 1 + resources: {} + customServiceConfig: | + [DEFAULT] + enabled_share_backends = cephfs + [cephfs] + driver_handles_share_servers=False + share_backend_name=cephfs + share_driver=manila.share.drivers.cephfs.driver.CephFSDriver + cephfs_conf_path=/etc/ceph/ceph.conf + cephfs_auth_id=openstack + cephfs_cluster_name=ceph + cephfs_protocol_helper_type=CEPHFS +status: + conditions: + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: CronJob completed + reason: Ready + status: "True" + type: CronJobReady + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: Setup complete + reason: Ready + status: "True" + type: ManilaAPIReady + - message: Setup complete + reason: Ready + status: "True" + type: ManilaSchedulerReady + - message: Deployment completed + reason: Ready + status: "True" + type: ManilaShareReady + - message: MariaDBAccount creation complete + reason: Ready + status: "True" + type: MariaDBAccountReady + - message: " Memcached instance has been provisioned" + reason: Ready + status: "True" + type: MemcachedReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - message: RabbitMqTransportURL successfully created + reason: Ready + status: "True" + type: RabbitMqTransportURLReady + - 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 + - message: Service config create completed + reason: Ready + status: "True" + type: ServiceConfigReady + manilaAPIReadyCount: 1 + manilaSchedulerReadyCount: 1 + manilaSharesReadyCounts: + share0: 1 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: manila-db-purge diff --git a/test/kuttl/tests/manila-basic/03-scale-down-manila-api.yaml b/test/kuttl/tests/manila-basic/tests/03-scale-down-manila-api.yaml similarity index 100% rename from test/kuttl/tests/manila-basic/03-scale-down-manila-api.yaml rename to test/kuttl/tests/manila-basic/tests/03-scale-down-manila-api.yaml diff --git a/test/kuttl/tests/manila-basic/tests/04-assert.yaml b/test/kuttl/tests/manila-basic/tests/04-assert.yaml new file mode 100644 index 00000000..013fda42 --- /dev/null +++ b/test/kuttl/tests/manila-basic/tests/04-assert.yaml @@ -0,0 +1,103 @@ +# +# Check for: +# +# - 1 manilaAPI +# - 2 manilaScheduler +# - 3 manilaShares +# - 4 extraMounts + +apiVersion: manila.openstack.org/v1beta1 +kind: Manila +metadata: + name: manila +spec: + manilaShares: + share0: + replicas: 1 + resources: {} + customServiceConfig: | + [DEFAULT] + enabled_share_backends = cephfs + [cephfs] + driver_handles_share_servers=False + share_backend_name=cephfs + share_driver=manila.share.drivers.cephfs.driver.CephFSDriver + cephfs_conf_path=/etc/ceph/ceph.conf + cephfs_auth_id=openstack + cephfs_cluster_name=ceph + cephfs_protocol_helper_type=CEPHFS +status: + conditions: + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: CronJob completed + reason: Ready + status: "True" + type: CronJobReady + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: Setup complete + reason: Ready + status: "True" + type: ManilaAPIReady + - message: Setup complete + reason: Ready + status: "True" + type: ManilaSchedulerReady + - message: Deployment completed + reason: Ready + status: "True" + type: ManilaShareReady + - message: MariaDBAccount creation complete + reason: Ready + status: "True" + type: MariaDBAccountReady + - message: " Memcached instance has been provisioned" + reason: Ready + status: "True" + type: MemcachedReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - message: RabbitMqTransportURL successfully created + reason: Ready + status: "True" + type: RabbitMqTransportURLReady + - 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 + - message: Service config create completed + reason: Ready + status: "True" + type: ServiceConfigReady + manilaAPIReadyCount: 1 + manilaSchedulerReadyCount: 3 + manilaSharesReadyCounts: + share0: 1 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: manila-db-purge diff --git a/test/kuttl/tests/manila-basic/04-scale-up-manila-scheduler.yaml b/test/kuttl/tests/manila-basic/tests/04-scale-up-manila-scheduler.yaml similarity index 100% rename from test/kuttl/tests/manila-basic/04-scale-up-manila-scheduler.yaml rename to test/kuttl/tests/manila-basic/tests/04-scale-up-manila-scheduler.yaml diff --git a/test/kuttl/tests/manila-basic/99-cleanup-manila.yaml b/test/kuttl/tests/manila-basic/tests/99-cleanup-manila.yaml similarity index 100% rename from test/kuttl/tests/manila-basic/99-cleanup-manila.yaml rename to test/kuttl/tests/manila-basic/tests/99-cleanup-manila.yaml diff --git a/test/kuttl/tests/manila-basic/99-errors.yaml b/test/kuttl/tests/manila-basic/tests/99-errors.yaml similarity index 100% rename from test/kuttl/tests/manila-basic/99-errors.yaml rename to test/kuttl/tests/manila-basic/tests/99-errors.yaml diff --git a/test/kuttl/tests/manila-multibackend/config.yaml b/test/kuttl/tests/manila-multibackend/config.yaml new file mode 100644 index 00000000..2ce5ef15 --- /dev/null +++ b/test/kuttl/tests/manila-multibackend/config.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestSuite +reportFormat: JSON +reportName: kuttl-manila-multibackend-results +namespace: manila-kuttl-tests +timeout: 300 +parallel: 1 +skipDelete: true +testDirs: + - test/kuttl/tests/manila-multibackend/tests +suppress: + - events +artifactsDir: tests/kuttl/tests/manila-multibackend/output diff --git a/test/kuttl/tests/manila-multibackend/01-assert.yaml b/test/kuttl/tests/manila-multibackend/tests/01-assert.yaml similarity index 53% rename from test/kuttl/tests/manila-multibackend/01-assert.yaml rename to test/kuttl/tests/manila-multibackend/tests/01-assert.yaml index eaad594e..9f935205 100644 --- a/test/kuttl/tests/manila-multibackend/01-assert.yaml +++ b/test/kuttl/tests/manila-multibackend/tests/01-assert.yaml @@ -9,21 +9,6 @@ kind: Manila metadata: name: manila spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols=nfs,cephfs,cifs - replicas: 1 - resources: {} - manilaScheduler: - customServiceConfig: '# add your customization here' - replicas: 1 - resources: {} manilaShares: share0: customServiceConfig: | @@ -37,7 +22,6 @@ spec: cephfs_auth_id=openstack cephfs_cluster_name=ceph cephfs_protocol_helper_type=CEPHFS - replicas: 1 share1: customServiceConfig: | [DEFAULT] @@ -50,13 +34,6 @@ spec: cephfs_cluster_name=ceph cephfs_nfs_cluster_id=cephfs cephfs_protocol_helper_type=NFS - replicas: 0 - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila status: conditions: - message: Setup complete @@ -128,61 +105,16 @@ status: manilaSharesReadyCounts: share0: 1 share1: 0 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport --- apiVersion: batch/v1 kind: CronJob metadata: name: manila-db-purge -spec: - jobTemplate: - metadata: - labels: - service: manila - spec: - completions: 1 - parallelism: 1 - template: - spec: - containers: - - args: - - -c - - /usr/bin/manila-manage --config-dir /etc/manila/manila.conf.d - db purge 30 - command: - - /bin/bash - name: manila-db-purge - volumeMounts: - - mountPath: /etc/manila/manila.conf.d - name: db-purge-config-data - readOnly: true - serviceAccount: manila-manila - serviceAccountName: manila-manila - volumes: - - name: db-purge-config-data - secret: - defaultMode: 420 - items: - - key: 00-config.conf - path: 00-config.conf - secretName: manila-config-data - schedule: 1 0 * * * - suspend: false --- apiVersion: manila.openstack.org/v1beta1 kind: ManilaShare metadata: name: manila-share-share0 -spec: - databaseAccount: manila - passwordSelectors: - service: ManilaPassword - replicas: 1 - resources: {} - secret: osp-secret - serviceAccount: manila-manila - serviceUser: manila - transportURLSecret: rabbitmq-transport-url-manila-manila-transport status: conditions: - message: Setup complete @@ -210,36 +142,3 @@ status: status: "True" type: TLSInputReady readyCount: 1 ---- -# when using image digests the containerImage URLs are SHA's so we verify them with a script -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: - - script: | - tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' - imageTuples=$(oc get -n openstack-operators deployment manila-operator-controller-manager -o go-template="$tupleTemplate") - # format of imageTuple is: RELATED_IMAGE_MANILA_# separated by newlines - for ITEM in $(echo $imageTuples); do - # it is an image - if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then - NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_MANILA_\([^_]*\)_.*|\1|') - IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') - template='{{.spec.containerImage}}' - case $NAME in - API) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilaapi manila-api -o go-template="$template") - ;; - SHARE) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilashares manila-share-share0 -o go-template="$template") - ;; - SCHEDULER) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilascheduler manila-scheduler -o go-template="$template") - ;; - esac - if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then - echo "$NAME image does not equal $VALUE" - exit 1 - fi - fi - done - exit 0 diff --git a/test/kuttl/tests/manila-multibackend/01-deploy-manila.yaml b/test/kuttl/tests/manila-multibackend/tests/01-deploy-manila.yaml similarity index 100% rename from test/kuttl/tests/manila-multibackend/01-deploy-manila.yaml rename to test/kuttl/tests/manila-multibackend/tests/01-deploy-manila.yaml diff --git a/test/kuttl/tests/manila-multibackend/02-assert.yaml b/test/kuttl/tests/manila-multibackend/tests/02-assert.yaml similarity index 73% rename from test/kuttl/tests/manila-multibackend/02-assert.yaml rename to test/kuttl/tests/manila-multibackend/tests/02-assert.yaml index 2d12309d..1d474b1a 100644 --- a/test/kuttl/tests/manila-multibackend/02-assert.yaml +++ b/test/kuttl/tests/manila-multibackend/tests/02-assert.yaml @@ -11,23 +11,8 @@ kind: Manila metadata: name: manila spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols=nfs,cephfs,cifs - replicas: 1 - resources: {} - manilaScheduler: - replicas: 1 - resources: {} manilaShares: share0: - replicas: 1 resources: {} customServiceConfig: | [DEFAULT] @@ -52,13 +37,6 @@ spec: cephfs_cluster_name=ceph cephfs_nfs_cluster_id=cephfs cephfs_protocol_helper_type=NFS - replicas: 1 - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila status: conditions: - message: Setup complete @@ -130,47 +108,18 @@ status: manilaSharesReadyCounts: share0: 1 share1: 1 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport --- apiVersion: manila.openstack.org/v1beta1 kind: ManilaAPI metadata: - finalizers: - - openstack.org/manilaapi name: manila-api -spec: - databaseAccount: manila - passwordSelectors: - service: ManilaPassword - replicas: 1 - resources: {} - secret: osp-secret - serviceAccount: manila-manila - serviceUser: manila status: readyCount: 1 --- apiVersion: apps/v1 kind: StatefulSet metadata: - labels: - component: manila-api - service: manila name: manila-api - ownerReferences: - - apiVersion: manila.openstack.org/v1beta1 - kind: ManilaAPI - name: manila-api -spec: - replicas: 1 - template: - metadata: - labels: - component: manila-api - service: manila - spec: - serviceAccount: manila-manila - serviceAccountName: manila-manila status: availableReplicas: 1 readyReplicas: 1 @@ -180,16 +129,6 @@ apiVersion: manila.openstack.org/v1beta1 kind: ManilaShare metadata: name: manila-share-share0 -spec: - databaseAccount: manila - passwordSelectors: - service: ManilaPassword - replicas: 1 - resources: {} - secret: osp-secret - serviceAccount: manila-manila - serviceUser: manila - transportURLSecret: rabbitmq-transport-url-manila-manila-transport status: conditions: - message: Setup complete @@ -222,16 +161,6 @@ apiVersion: manila.openstack.org/v1beta1 kind: ManilaShare metadata: name: manila-share-share1 -spec: - databaseAccount: manila - passwordSelectors: - service: ManilaPassword - replicas: 1 - resources: {} - secret: osp-secret - serviceAccount: manila-manila - serviceUser: manila - transportURLSecret: rabbitmq-transport-url-manila-manila-transport status: conditions: - message: Setup complete diff --git a/test/kuttl/tests/manila-multibackend/02-scale-up-manila-share.yaml b/test/kuttl/tests/manila-multibackend/tests/02-scale-up-manila-share.yaml similarity index 100% rename from test/kuttl/tests/manila-multibackend/02-scale-up-manila-share.yaml rename to test/kuttl/tests/manila-multibackend/tests/02-scale-up-manila-share.yaml diff --git a/test/kuttl/tests/manila-multibackend/03-assert.yaml b/test/kuttl/tests/manila-multibackend/tests/03-assert.yaml similarity index 53% rename from test/kuttl/tests/manila-multibackend/03-assert.yaml rename to test/kuttl/tests/manila-multibackend/tests/03-assert.yaml index f880b3ea..90e96ac2 100644 --- a/test/kuttl/tests/manila-multibackend/03-assert.yaml +++ b/test/kuttl/tests/manila-multibackend/tests/03-assert.yaml @@ -11,25 +11,8 @@ kind: Manila metadata: name: manila spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols=nfs,cephfs,cifs - replicas: 1 - resources: {} - manilaScheduler: - customServiceConfig: '# add your customization here' - replicas: 1 - resources: {} manilaShares: share0: - replicas: 0 - resources: {} customServiceConfig: | [DEFAULT] enabled_share_backends = cephfs @@ -42,7 +25,6 @@ spec: cephfs_cluster_name=ceph cephfs_protocol_helper_type=CEPHFS share1: - replicas: 1 customServiceConfig: | [DEFAULT] enabled_share_backends=cephfsnfs @@ -54,12 +36,6 @@ spec: cephfs_cluster_name=ceph cephfs_nfs_cluster_id=cephfs cephfs_protocol_helper_type=NFS - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila status: conditions: - message: Setup complete @@ -131,61 +107,16 @@ status: manilaSharesReadyCounts: share0: 0 share1: 1 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport --- apiVersion: batch/v1 kind: CronJob metadata: name: manila-db-purge -spec: - jobTemplate: - metadata: - labels: - service: manila - spec: - completions: 1 - parallelism: 1 - template: - spec: - containers: - - args: - - -c - - /usr/bin/manila-manage --config-dir /etc/manila/manila.conf.d - db purge 30 - command: - - /bin/bash - name: manila-db-purge - volumeMounts: - - mountPath: /etc/manila/manila.conf.d - name: db-purge-config-data - readOnly: true - serviceAccount: manila-manila - serviceAccountName: manila-manila - volumes: - - name: db-purge-config-data - secret: - defaultMode: 420 - items: - - key: 00-config.conf - path: 00-config.conf - secretName: manila-config-data - schedule: 1 0 * * * - suspend: false --- apiVersion: manila.openstack.org/v1beta1 kind: ManilaShare metadata: name: manila-share-share1 -spec: - databaseAccount: manila - passwordSelectors: - service: ManilaPassword - replicas: 1 - resources: {} - secret: osp-secret - serviceAccount: manila-manila - serviceUser: manila - transportURLSecret: rabbitmq-transport-url-manila-manila-transport status: conditions: - message: Setup complete @@ -213,36 +144,3 @@ status: status: "True" type: TLSInputReady readyCount: 1 ---- -# when using image digests the containerImage URLs are SHA's so we verify them with a script -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: - - script: | - tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' - imageTuples=$(oc get -n openstack-operators deployment manila-operator-controller-manager -o go-template="$tupleTemplate") - # format of imageTuple is: RELATED_IMAGE_MANILA_# separated by newlines - for ITEM in $(echo $imageTuples); do - # it is an image - if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then - NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_MANILA_\([^_]*\)_.*|\1|') - IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') - template='{{.spec.containerImage}}' - case $NAME in - API) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilaapi manila-api -o go-template="$template") - ;; - SHARE) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilashares manila-share-share1 -o go-template="$template") - ;; - SCHEDULER) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilascheduler manila-scheduler -o go-template="$template") - ;; - esac - if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then - echo "$NAME image does not equal $VALUE" - exit 1 - fi - fi - done - exit 0 diff --git a/test/kuttl/tests/manila-multibackend/03-scale-down-manila-share.yaml b/test/kuttl/tests/manila-multibackend/tests/03-scale-down-manila-share.yaml similarity index 100% rename from test/kuttl/tests/manila-multibackend/03-scale-down-manila-share.yaml rename to test/kuttl/tests/manila-multibackend/tests/03-scale-down-manila-share.yaml diff --git a/test/kuttl/tests/manila-multibackend/04-assert.yaml b/test/kuttl/tests/manila-multibackend/tests/04-assert.yaml similarity index 50% rename from test/kuttl/tests/manila-multibackend/04-assert.yaml rename to test/kuttl/tests/manila-multibackend/tests/04-assert.yaml index bf8084e5..ab8a8e9b 100644 --- a/test/kuttl/tests/manila-multibackend/04-assert.yaml +++ b/test/kuttl/tests/manila-multibackend/tests/04-assert.yaml @@ -10,24 +10,8 @@ kind: Manila metadata: name: manila spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols=nfs,cephfs,cifs - replicas: 1 - resources: {} - manilaScheduler: - customServiceConfig: '# add your customization here' - replicas: 1 - resources: {} manilaShares: share1: - replicas: 1 customServiceConfig: | [DEFAULT] enabled_share_backends=cephfsnfs @@ -39,12 +23,6 @@ spec: cephfs_cluster_name=ceph cephfs_nfs_cluster_id=cephfs cephfs_protocol_helper_type=NFS - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila status: conditions: - message: Setup complete @@ -115,61 +93,16 @@ status: manilaSchedulerReadyCount: 1 manilaSharesReadyCounts: share1: 1 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport --- apiVersion: batch/v1 kind: CronJob metadata: name: manila-db-purge -spec: - jobTemplate: - metadata: - labels: - service: manila - spec: - completions: 1 - parallelism: 1 - template: - spec: - containers: - - args: - - -c - - /usr/bin/manila-manage --config-dir /etc/manila/manila.conf.d - db purge 30 - command: - - /bin/bash - name: manila-db-purge - volumeMounts: - - mountPath: /etc/manila/manila.conf.d - name: db-purge-config-data - readOnly: true - serviceAccount: manila-manila - serviceAccountName: manila-manila - volumes: - - name: db-purge-config-data - secret: - defaultMode: 420 - items: - - key: 00-config.conf - path: 00-config.conf - secretName: manila-config-data - schedule: 1 0 * * * - suspend: false --- apiVersion: manila.openstack.org/v1beta1 kind: ManilaShare metadata: name: manila-share-share1 -spec: - databaseAccount: manila - passwordSelectors: - service: ManilaPassword - replicas: 1 - resources: {} - secret: osp-secret - serviceAccount: manila-manila - serviceUser: manila - transportURLSecret: rabbitmq-transport-url-manila-manila-transport status: conditions: - message: Setup complete @@ -197,36 +130,3 @@ status: status: "True" type: TLSInputReady readyCount: 1 ---- -# when using image digests the containerImage URLs are SHA's so we verify them with a script -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: - - script: | - tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' - imageTuples=$(oc get -n openstack-operators deployment manila-operator-controller-manager -o go-template="$tupleTemplate") - # format of imageTuple is: RELATED_IMAGE_MANILA_# separated by newlines - for ITEM in $(echo $imageTuples); do - # it is an image - if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then - NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_MANILA_\([^_]*\)_.*|\1|') - IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') - template='{{.spec.containerImage}}' - case $NAME in - API) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilaapi manila-api -o go-template="$template") - ;; - SHARE) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilashares manila-share-share1 -o go-template="$template") - ;; - SCHEDULER) - SERVICE_IMAGE=$(oc get -n $NAMESPACE manilascheduler manila-scheduler -o go-template="$template") - ;; - esac - if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then - echo "$NAME image does not equal $VALUE" - exit 1 - fi - fi - done - exit 0 diff --git a/test/kuttl/tests/manila-multibackend/04-remove-share.yaml b/test/kuttl/tests/manila-multibackend/tests/04-remove-share.yaml similarity index 100% rename from test/kuttl/tests/manila-multibackend/04-remove-share.yaml rename to test/kuttl/tests/manila-multibackend/tests/04-remove-share.yaml diff --git a/test/kuttl/tests/manila-multibackend/05-cleanup-manila.yaml b/test/kuttl/tests/manila-multibackend/tests/05-cleanup-manila.yaml similarity index 100% rename from test/kuttl/tests/manila-multibackend/05-cleanup-manila.yaml rename to test/kuttl/tests/manila-multibackend/tests/05-cleanup-manila.yaml diff --git a/test/kuttl/tests/manila-multibackend/05-errors.yaml b/test/kuttl/tests/manila-multibackend/tests/05-errors.yaml similarity index 100% rename from test/kuttl/tests/manila-multibackend/05-errors.yaml rename to test/kuttl/tests/manila-multibackend/tests/05-errors.yaml diff --git a/test/kuttl/tests/manila-tls/config.yaml b/test/kuttl/tests/manila-tls/config.yaml new file mode 100644 index 00000000..9370d44d --- /dev/null +++ b/test/kuttl/tests/manila-tls/config.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestSuite +reportFormat: JSON +reportName: kuttl-manila-tls-results +namespace: manila-kuttl-tests +timeout: 300 +parallel: 1 +skipDelete: true +testDirs: + - test/kuttl/tests/manila-tls/tests +suppress: + - events +artifactsDir: tests/kuttl/tests/manila-tls/output diff --git a/test/kuttl/tests/manila-tls/01-assert.yaml b/test/kuttl/tests/manila-tls/tests/01-assert.yaml similarity index 100% rename from test/kuttl/tests/manila-tls/01-assert.yaml rename to test/kuttl/tests/manila-tls/tests/01-assert.yaml diff --git a/test/kuttl/tests/manila-tls/01-tls_certificates.yaml b/test/kuttl/tests/manila-tls/tests/01-tls_certificates.yaml similarity index 100% rename from test/kuttl/tests/manila-tls/01-tls_certificates.yaml rename to test/kuttl/tests/manila-tls/tests/01-tls_certificates.yaml diff --git a/test/kuttl/tests/manila-tls/02-manila-deploy.yaml b/test/kuttl/tests/manila-tls/tests/02-manila-deploy.yaml similarity index 100% rename from test/kuttl/tests/manila-tls/02-manila-deploy.yaml rename to test/kuttl/tests/manila-tls/tests/02-manila-deploy.yaml diff --git a/test/kuttl/tests/manila-tls/03-assert.yaml b/test/kuttl/tests/manila-tls/tests/03-assert.yaml similarity index 85% rename from test/kuttl/tests/manila-tls/03-assert.yaml rename to test/kuttl/tests/manila-tls/tests/03-assert.yaml index e2aacf88..b720200a 100644 --- a/test/kuttl/tests/manila-tls/03-assert.yaml +++ b/test/kuttl/tests/manila-tls/tests/03-assert.yaml @@ -3,70 +3,6 @@ kind: Manila metadata: name: manila namespace: manila-kuttl-tests -spec: - customServiceConfig: | - [DEFAULT] - debug = true - databaseInstance: openstack - databaseAccount: manila - dbPurge: - age: 30 - schedule: 1 0 * * * - extraMounts: - - extraVol: - - extraVolType: Ceph - mounts: - - mountPath: /etc/ceph - name: ceph - readOnly: true - propagation: - - share0 - volumes: - - name: ceph - secret: - secretName: ceph-conf-files - name: v1 - region: r1 - manilaAPI: - customServiceConfig: | - [DEFAULT] - enabled_share_protocols = cephfs - override: {} - replicas: 1 - resources: {} - tls: - api: - internal: - secretName: cert-manila-internal-svc - public: - secretName: cert-manila-public-svc - caBundleSecretName: combined-ca-bundle - manilaScheduler: - customServiceConfig: '# add your customization here' - replicas: 1 - resources: {} - manilaShares: - share0: - customServiceConfig: | - [DEFAULT] - enabled_share_backends = cephfs - [cephfs] - driver_handles_share_servers=False - share_backend_name=cephfs - share_driver=manila.share.drivers.cephfs.driver.CephFSDriver - cephfs_conf_path=/etc/ceph/ceph.conf - cephfs_auth_id=openstack - cephfs_cluster_name=ceph - cephfs_protocol_helper_type=CEPHFS - replicas: 1 - resources: {} - memcachedInstance: memcached - passwordSelectors: - service: ManilaPassword - preserveJobs: false - rabbitMqClusterName: rabbitmq - secret: osp-secret - serviceUser: manila status: conditions: - message: Setup complete @@ -133,12 +69,10 @@ status: reason: Ready status: "True" type: ServiceConfigReady - databaseHostname: openstack.manila-kuttl-tests.svc manilaAPIReadyCount: 1 manilaSchedulerReadyCount: 1 manilaSharesReadyCounts: share0: 1 - transportURLSecret: rabbitmq-transport-url-manila-manila-transport --- apiVersion: batch/v1 kind: CronJob @@ -150,8 +84,6 @@ spec: labels: service: manila spec: - completions: 1 - parallelism: 1 template: spec: containers: @@ -169,8 +101,6 @@ spec: - mountPath: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem name: combined-ca-bundle readOnly: true - serviceAccount: manila-manila - serviceAccountName: manila-manila volumes: - name: db-purge-config-data secret: @@ -183,24 +113,11 @@ spec: secret: defaultMode: 292 secretName: combined-ca-bundle - schedule: 1 0 * * * - suspend: false --- apiVersion: manila.openstack.org/v1beta1 kind: ManilaShare metadata: name: manila-share-share0 -spec: - databaseHostname: openstack.manila-kuttl-tests.svc - databaseAccount: manila - passwordSelectors: - service: ManilaPassword - replicas: 1 - resources: {} - secret: osp-secret - serviceAccount: manila-manila - serviceUser: manila - transportURLSecret: rabbitmq-transport-url-manila-manila-transport status: conditions: - message: Setup complete @@ -246,7 +163,6 @@ spec: component: manila-api service: manila spec: - serviceAccountName: manila-manila containers: - args: - --single-child diff --git a/test/kuttl/tests/manila-tls/04-cleanup-manila.yaml b/test/kuttl/tests/manila-tls/tests/04-cleanup-manila.yaml similarity index 100% rename from test/kuttl/tests/manila-tls/04-cleanup-manila.yaml rename to test/kuttl/tests/manila-tls/tests/04-cleanup-manila.yaml