diff --git a/test/kuttl/tests/manila-multibackend/04-assert.yaml b/test/kuttl/tests/manila-multibackend/04-assert.yaml new file mode 100644 index 00000000..c0d5a708 --- /dev/null +++ b/test/kuttl/tests/manila-multibackend/04-assert.yaml @@ -0,0 +1,233 @@ +# 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=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 + [cephfsnfs] + driver_handles_share_servers=False + share_backend_name=cephfs + share_driver=manila.share.drivers.cephfs.driver.CephFSDriver + cephfs_auth_id=openstack + 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 + 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: + 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 + reason: Ready + status: "True" + type: Ready + - message: Deployment completed + reason: Ready + status: "True" + type: DeploymentReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - message: Service config create completed + reason: Ready + status: "True" + type: ServiceConfigReady + - message: Input data complete + reason: Ready + 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/04-remove-share.yaml new file mode 100644 index 00000000..0132c746 --- /dev/null +++ b/test/kuttl/tests/manila-multibackend/04-remove-share.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc patch manila -n $NAMESPACE manila --type='json' -p='[{"op": "remove", "path": "/spec/manilaShares/share0"}]' diff --git a/test/kuttl/tests/manila-multibackend/04-cleanup-manila.yaml b/test/kuttl/tests/manila-multibackend/05-cleanup-manila.yaml similarity index 100% rename from test/kuttl/tests/manila-multibackend/04-cleanup-manila.yaml rename to test/kuttl/tests/manila-multibackend/05-cleanup-manila.yaml diff --git a/test/kuttl/tests/manila-multibackend/04-errors.yaml b/test/kuttl/tests/manila-multibackend/05-errors.yaml similarity index 100% rename from test/kuttl/tests/manila-multibackend/04-errors.yaml rename to test/kuttl/tests/manila-multibackend/05-errors.yaml