Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(GcpRedisInstance): add GcpRedisInstance feature test #24

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ Dockerfile.cross
*.swp
*.swo
*~

.vscode
2 changes: 1 addition & 1 deletion features/200-awsnfsvolume.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: AwsNfsVolume feature
spec:
capacity: 10G
"""
Then eventually value load("vol").status.state equals "Ready" with timeout2X
Then eventually value load("vol").status.state equals "Ready"
And eventually value load("pv").status.phase equals "Bound"
And eventually value load("pvc").status.phase equals "Bound"

Expand Down
2 changes: 1 addition & 1 deletion features/200-gcpnfsvolume.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: GcpNfsVolume feature
spec:
capacityGb: 1024
"""
Then eventually value load("vol").status.state equals "Ready"
Then eventually value load("vol").status.state equals "Ready" with timeout2X
And eventually value load("pv").status.phase equals "Bound"
And eventually value load("pvc").status.phase equals "Bound"

Expand Down
75 changes: 75 additions & 0 deletions features/300-gcpredisinstance.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Feature: GcpRedisInstance feature

@gcp @allShoots @allEnvs
Scenario: GcpRedisInstance scenario
Given resource declaration:
| redis | GcpRedisInstance | "redis-"+rndStr(8) | namespace |
| authSecret | Secret | redis.metadata.name | namespace |
| pod | Pod | "redis-probe-"+rndStr(8) | namespace |
When resource redis is applied:
"""
apiVersion: cloud-resources.kyma-project.io/v1beta1
kind: GcpRedisInstance
spec:
memorySizeGb: 5
tier: "STANDARD_HA"
redisVersion: REDIS_7_1
authEnabled: true
transitEncryption:
serverAuthentication: true
redisConfigs:
maxmemory-policy: volatile-lru
activedefrag: "yes"
maintenancePolicy:
dayOfWeek:
day: "SATURDAY"
startTime:
hours: 15
minutes: 45
"""
Then eventually value load("redis").status.state equals "Ready" with timeout5X

When resource pod is applied:
"""
apiVersion: v1
kind: Pod
spec:
containers:
- name: redis-cli
image: redis:latest
command: ["/bin/bash", "-c", "--"]
args: ["redis-cli -h $HOST -p $PORT -a $AUTH_STRING --tls --cacert /mnt/CaCert.pem PING"]
env:
- name: HOST
valueFrom:
secretKeyRef:
key: host
name: <(redis.metadata.name)>
- name: PORT
valueFrom:
secretKeyRef:
key: port
name: <(redis.metadata.name)>
- name: AUTH_STRING
valueFrom:
secretKeyRef:
key: authString
name: <(redis.metadata.name)>
volumeMounts:
- name: mounted
mountPath: /mnt
volumes:
- name: mounted
secret:
secretName: <(redis.metadata.name)>
restartPolicy: Never
"""
Then eventually value load("pod").status.phase equals "Succeeded"
And value logs("pod").search(/PONG/) > -1 equals true

When resource pod is deleted
Then eventually resource pod does not exist

When resource redis is deleted
Then eventually resource authSecret does not exist
And eventually resource redis does not exist
Loading