diff --git a/features/200-gcpnfsvolume.feature b/features/200-gcpnfsvolume.feature index 8081c88..37c5c89 100644 --- a/features/200-gcpnfsvolume.feature +++ b/features/200-gcpnfsvolume.feature @@ -1,12 +1,14 @@ Feature: GcpNfsVolume feature @gcp @allShoots @allEnvs - Scenario: GcpNfsVolume scenario + Scenario: GcpNfsVolume/Backup/Restore scenario Given resource declaration: - | vol | GcpNfsVolume | "vol-"+rndStr(8) | namespace | - | pv | PersistentVolume | vol.status.id | | - | pvc | PersistentVolumeClaim | vol.metadata.name | namespace | - | pod | Pod | "test-vol" | namespace | + | vol | GcpNfsVolume | "vol-200-gcpnfsvolume" | namespace | + | pv | PersistentVolume | vol.status.id | | + | pvc | PersistentVolumeClaim | vol.metadata.name | namespace | + | pod | Pod | "test-vol-200-gcpnfsvolume" | namespace | + | backup | GcpNfsVolumeBackup | "backup-200-gcpnfsvolume" | namespace | + | restore | GcpNfsVolumeRestore | "restore-200-gcpnfsvolume" | namespace | When resource vol is applied: """ apiVersion: cloud-resources.kyma-project.io/v1beta1 @@ -48,7 +50,145 @@ Feature: GcpNfsVolume feature When resource pod is deleted Then eventually resource pod does not exist + When resource backup is applied: + """ + apiVersion: cloud-resources.kyma-project.io/v1beta1 + kind: GcpNfsVolumeBackup + spec: + source: + volume: + name: <(vol.metadata.name)> + """ + Then eventually value load("backup").status.state equals "Ready" with timeout2X + + When resource pod is applied: + """ + apiVersion: v1 + kind: Pod + spec: + volumes: + - name: data + persistentVolumeClaim: + claimName: <(vol.metadata.name)> + containers: + - name: cloud1 + image: ubuntu + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: "/mnt/data1" + name: data + command: + - "/bin/bash" + - "-c" + - "--" + args: + - "rm /mnt/data1/test.txt & echo 'test.txt was deleted'" + restartPolicy: Never + """ + Then eventually value load("pod").status.phase equals "Succeeded" + And value logs("pod").search(/test.txt was deleted/) > -1 equals true + + When resource pod is deleted + Then eventually resource pod does not exist + + When resource restore is applied: + """ + apiVersion: cloud-resources.kyma-project.io/v1beta1 + kind: GcpNfsVolumeRestore + spec: + source: + backup: + name: <(backup.metadata.name)> + namespace: <(backup.metadata.namespace)> + destination: + volume: + name: <(vol.metadata.name)> + """ + Then eventually value load("restore").status.state equals "Done" with timeout2X + + When resource pod is applied: + """ + apiVersion: v1 + kind: Pod + spec: + volumes: + - name: data + persistentVolumeClaim: + claimName: <(vol.metadata.name)> + containers: + - name: cloud1 + image: ubuntu + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: "/mnt/data1" + name: data + command: + - "/bin/bash" + - "-c" + - "--" + args: + - "cat /mnt/data1/test.txt" + restartPolicy: Never + """ + Then eventually value load("pod").status.phase equals "Succeeded" + And value logs("pod").search(/test line/) > -1 equals true + + When resource pod is deleted + Then eventually resource pod does not exist + + When resource restore is deleted + Then eventually resource restore does not exist When resource vol is deleted Then eventually resource pvc does not exist And eventually resource pv does not exist And eventually resource vol does not exist + + When resource vol is applied: + """ + apiVersion: cloud-resources.kyma-project.io/v1beta1 + kind: GcpNfsVolume + spec: + capacityGb: 1024 + sourceBackup: + name: <(backup.metadata.name)> + namespace: <(backup.metadata.namespace)> + """ + Then eventually value load("vol").status.state equals "Ready" with timeout2X + + When resource pod is applied: + """ + apiVersion: v1 + kind: Pod + spec: + volumes: + - name: data + persistentVolumeClaim: + claimName: <(vol.metadata.name)> + containers: + - name: cloud1 + image: ubuntu + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: "/mnt/data1" + name: data + command: + - "/bin/bash" + - "-c" + - "--" + args: + - "cat /mnt/data1/test.txt" + restartPolicy: Never + """ + Then eventually value load("pod").status.phase equals "Succeeded" + And value logs("pod").search(/test line/) > -1 equals true + + When resource pod is deleted + Then eventually resource pod does not exist + + When resource vol is deleted + Then eventually resource vol does not exist + + When resource backup is deleted + Then eventually resource backup does not exist + + diff --git a/features/200-gcpnfsvolumebackup.feature b/features/200-gcpnfsvolumebackup.feature deleted file mode 100644 index a50655b..0000000 --- a/features/200-gcpnfsvolumebackup.feature +++ /dev/null @@ -1,33 +0,0 @@ -Feature: GcpNfsVolumeBackup feature - - @gcp @allShoots @allEnvs - Scenario: GcpNfsVolumeBackup scenario - Given resource declaration: - | vol | GcpNfsVolume | "vol-"+rndStr(8) | namespace | - | backup | GcpNfsVolumeBackup | "backup-"+rndStr(8) | namespace | - When resource vol is applied: - """ - apiVersion: cloud-resources.kyma-project.io/v1beta1 - kind: GcpNfsVolume - spec: - capacityGb: 1024 - """ - Then eventually value load("vol").status.state equals "Ready" with timeout2X - - When resource backup is applied: - """ - apiVersion: cloud-resources.kyma-project.io/v1beta1 - kind: GcpNfsVolumeBackup - spec: - source: - volume: - name: <(vol.metadata.name)> - """ - Then eventually value load("backup").status.state equals "Ready" with timeout2X - - When resource backup is deleted - Then eventually resource backup does not exist - - When resource vol is deleted - Then eventually resource vol does not exist - diff --git a/features/200-gcpnfsvolumerestore-newvolume.feature b/features/200-gcpnfsvolumerestore-newvolume.feature deleted file mode 100644 index 60e42c3..0000000 --- a/features/200-gcpnfsvolumerestore-newvolume.feature +++ /dev/null @@ -1,115 +0,0 @@ -Feature: GcpNfsVolumeRestore-NewVolume feature - - @gcp @allShoots @allEnvs - Scenario: GcpNfsVolumeRestore-NewVolume scenario - Given resource declaration: - | vol | GcpNfsVolume | "vol-"+rndStr(8) | namespace | - | backup | GcpNfsVolumeBackup | "backup-"+rndStr(8) | namespace | - | vol2 | GcpNfsVolume | "vol-"+rndStr(8) | namespace | - | pod | Pod | "test-vol" | namespace | - | pod2 | Pod | "test-vol2" | namespace | - - When resource vol is applied: - """ - apiVersion: cloud-resources.kyma-project.io/v1beta1 - kind: GcpNfsVolume - spec: - capacityGb: 1024 - """ - Then eventually value load("vol").status.state equals "Ready" with timeout2X - - When resource pod is applied: - """ - apiVersion: v1 - kind: Pod - spec: - volumes: - - name: data - persistentVolumeClaim: - claimName: <(vol.metadata.name)> - containers: - - name: cloud1 - image: ubuntu - imagePullPolicy: IfNotPresent - volumeMounts: - - mountPath: "/mnt/data1" - name: data - command: - - "/bin/bash" - - "-c" - - "--" - args: - - "echo 'test line' > /mnt/data1/test.txt & cat /mnt/data1/test.txt" - restartPolicy: Never - """ - Then eventually value load("pod").status.phase equals "Succeeded" - And value logs("pod").search(/test line/) > -1 equals true - - - When resource backup is applied: - """ - apiVersion: cloud-resources.kyma-project.io/v1beta1 - kind: GcpNfsVolumeBackup - spec: - source: - volume: - name: <(vol.metadata.name)> - """ - Then eventually value load("backup").status.state equals "Ready" with timeout2X - - When resource vol2 is applied: - """ - apiVersion: cloud-resources.kyma-project.io/v1beta1 - kind: GcpNfsVolume - spec: - capacityGb: 1024 - sourceBackup: - name: <(backup.metadata.name)> - namespace: <(backup.metadata.namespace)> - """ - Then eventually value load("vol2").status.state equals "Ready" with timeout2X - - When resource pod2 is applied: - """ - apiVersion: v1 - kind: Pod - spec: - volumes: - - name: data - persistentVolumeClaim: - claimName: <(vol.metadata.name)> - containers: - - name: cloud1 - image: ubuntu - imagePullPolicy: IfNotPresent - volumeMounts: - - mountPath: "/mnt/data1" - name: data - command: - - "/bin/bash" - - "-c" - - "--" - args: - - "cat /mnt/data1/test.txt" - restartPolicy: Never - """ - Then eventually value load("pod2").status.phase equals "Succeeded" - And value logs("pod2").search(/test line/) > -1 equals true - - When resource pod is deleted - Then eventually resource pod does not exist - - When resource pod2 is deleted - Then eventually resource pod2 does not exist - - When resource vol2 is deleted - Then eventually resource vol2 does not exist - - When resource backup is deleted - Then eventually resource backup does not exist - - When resource vol is deleted - Then eventually resource vol does not exist - - - diff --git a/features/200-gcpnfsvolumerestore.feature b/features/200-gcpnfsvolumerestore.feature deleted file mode 100644 index fabddbb..0000000 --- a/features/200-gcpnfsvolumerestore.feature +++ /dev/null @@ -1,145 +0,0 @@ -Feature: GcpNfsVolumeRestore feature - - @gcp @allShoots @allEnvs - Scenario: GcpNfsVolumeRestore scenario - Given resource declaration: - | vol | GcpNfsVolume | "vol-"+rndStr(8) | namespace | - | backup | GcpNfsVolumeBackup | "backup-"+rndStr(8) | namespace | - | restore | GcpNfsVolumeRestore | "restore-"+rndStr(8) | namespace | - | pod | Pod | "test-vol" | namespace | - - When resource vol is applied: - """ - apiVersion: cloud-resources.kyma-project.io/v1beta1 - kind: GcpNfsVolume - spec: - capacityGb: 1024 - """ - Then eventually value load("vol").status.state equals "Ready" with timeout2X - - When resource pod is applied: - """ - apiVersion: v1 - kind: Pod - spec: - volumes: - - name: data - persistentVolumeClaim: - claimName: <(vol.metadata.name)> - containers: - - name: cloud1 - image: ubuntu - imagePullPolicy: IfNotPresent - volumeMounts: - - mountPath: "/mnt/data1" - name: data - command: - - "/bin/bash" - - "-c" - - "--" - args: - - "echo 'test line' > /mnt/data1/test.txt & cat /mnt/data1/test.txt" - restartPolicy: Never - """ - Then eventually value load("pod").status.phase equals "Succeeded" - And value logs("pod").search(/test line/) > -1 equals true - - When resource backup is applied: - """ - apiVersion: cloud-resources.kyma-project.io/v1beta1 - kind: GcpNfsVolumeBackup - spec: - source: - volume: - name: <(vol.metadata.name)> - """ - Then eventually value load("backup").status.state equals "Ready" with timeout2X - - When resource pod is deleted - Then eventually resource pod does not exist - - When resource pod is applied: - """ - apiVersion: v1 - kind: Pod - spec: - volumes: - - name: data - persistentVolumeClaim: - claimName: <(vol.metadata.name)> - containers: - - name: cloud1 - image: ubuntu - imagePullPolicy: IfNotPresent - volumeMounts: - - mountPath: "/mnt/data1" - name: data - command: - - "/bin/bash" - - "-c" - - "--" - args: - - "rm /mnt/data1/test.txt & echo 'test.txt was deleted'" - restartPolicy: Never - """ - Then eventually value load("pod").status.phase equals "Succeeded" - And value logs("pod").search(/test.txt was deleted/) > -1 equals true - - When resource pod is deleted - Then eventually resource pod does not exist - - When resource restore is applied: - """ - apiVersion: cloud-resources.kyma-project.io/v1beta1 - kind: GcpNfsVolumeRestore - spec: - source: - backup: - name: <(backup.metadata.name)> - namespace: <(backup.metadata.namespace)> - destination: - volume: - name: <(vol.metadata.name)> - """ - Then eventually value load("restore").status.state equals "Done" with timeout2X - - When resource pod is applied: - """ - apiVersion: v1 - kind: Pod - spec: - volumes: - - name: data - persistentVolumeClaim: - claimName: <(vol.metadata.name)> - containers: - - name: cloud1 - image: ubuntu - imagePullPolicy: IfNotPresent - volumeMounts: - - mountPath: "/mnt/data1" - name: data - command: - - "/bin/bash" - - "-c" - - "--" - args: - - "cat /mnt/data1/test.txt" - restartPolicy: Never - """ - Then eventually value load("pod").status.phase equals "Succeeded" - And value logs("pod").search(/test line/) > -1 equals true - - When resource pod is deleted - Then eventually resource pod does not exist - - When resource restore is deleted - Then eventually resource restore does not exist - - When resource backup is deleted - Then eventually resource backup does not exist - - When resource vol is deleted - Then eventually resource vol does not exist - -