Skip to content

Commit

Permalink
Use redis operator for marketplace story
Browse files Browse the repository at this point in the history
As per https://github.com/coreos/etcd-operator etcd operator is no
longer developed or maintained so better to use better operator for
our test case.

Also as per marketplace test we only need to see if we can operator
can be installed and we can deploy respective resource from this
operator.

fixes: #2542
  • Loading branch information
praveenkumar committed Jul 8, 2021
1 parent 40e20ca commit e50d881
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 53 deletions.
35 changes: 9 additions & 26 deletions test/e2e/features/story_marketplace.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ Feature: Operator from marketplace

@darwin @linux @windows @testdata
Scenario: Install new operator
When executing "oc apply -f etcdop-sub.yaml" succeeds
When executing "oc apply -f redis-sub.yaml" succeeds
# check if cluster operator is running
Then with up to "20" retries with wait period of "30s" command "oc get csv" output matches ".*etcdoperator\.(.*)Succeeded$"
Then with up to "20" retries with wait period of "30s" command "oc get csv" output matches ".*redis-operator\.(.*)Succeeded$"

@darwin @linux @windows @testdata
Scenario: Scale up
# start cluster with 3 pods
When executing "oc apply -f etcd-cluster3.yaml" succeeds
Then with up to "10" retries with wait period of "30s" command "oc get pods" output matches "(?s)(.*example-[a-z0-9]* *1/1 *Running.*){3}"
# reconfigure cluster to 5 pods
When executing "oc apply -f etcd-cluster5.yaml" succeeds
Then with up to "10" retries with wait period of "30s" command "oc get pods" output matches "(?s)(.*example-[a-z0-9]* *1/1 *Running.*){5}"
Scenario: Install the redis instance
When executing "oc apply -f redis-cluster.yaml" succeeds
Then with up to "10" retries with wait period of "30s" command "oc get pods" output matches "redis-standalone-[a-z0-9]* .*Running.*"

@darwin @linux
Scenario: Failover
Expand All @@ -44,11 +40,8 @@ Feature: Operator from marketplace
And executing "echo $POD" succeeds
And executing "oc delete pod $POD --now" succeeds
Then stdout should match "^pod(.*)deleted$"
# after a while 5 pods should be up & running again
And with up to "10" retries with wait period of "30s" command "oc get pods" output matches "(?s)(.*example-[a-z0-9]* *1/1 *Running.*){5}"
# but the deleted pod should not be up, it was replaced
But executing "oc get pods $POD" fails
And stderr matches "(.*)pods (.*) not found$"
# after a while 1 pods should be up & running again
And with up to "10" retries with wait period of "30s" command "oc get pods" output matches "redis-standalone-[a-z0-9]* .*Running.*"

@windows
Scenario: Failover
Expand All @@ -57,18 +50,8 @@ Feature: Operator from marketplace
And executing "echo $Env:POD" succeeds
And executing "oc delete pod $Env:POD --now" succeeds
Then stdout should match "^pod(.*)deleted$"
# after a while 5 pods should be up & running again
And with up to "10" retries with wait period of "30s" command "oc get pods" output matches "(?s)(.*example-[a-z0-9]* *1/1 *Running.*){5}"
# but the deleted pod should not be up, it was replaced
But executing "oc get pods $Env:POD" fails
And stderr matches "(.*)pods (.*) not found$"

@darwin @linux @windows @testdata
Scenario: Scale down
# scale back down to 3 pods
When executing "oc apply -f etcd-cluster3.yaml" succeeds
Then with up to "10" retries with wait period of "30s" command "oc get pods" output matches "(?s)(.*example-[a-z0-9]* *1/1 *Running.*){3}"
But with up to "10" retries with wait period of "30s" command "oc get pods" output does not match "(?s)(.*example-[a-z0-9]* *1/1 *Running.*){4}"
# after a while 1 pods should be up & running again
And with up to "10" retries with wait period of "30s" command "oc get pods" output matches "redis-standalone-[a-z0-9]* .*Running.*"

@darwin @linux @windows
Scenario: Clean up
Expand Down
12 changes: 0 additions & 12 deletions test/testdata/etcd-cluster3.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions test/testdata/etcd-cluster5.yaml

This file was deleted.

49 changes: 49 additions & 0 deletions test/testdata/redis-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
apiVersion: v1
data:
password: c3VwZXJzZWNyZXQ=
kind: Secret
metadata:
name: redis-secret
namespace: default
---
apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: Redis
metadata:
name: redis-standalone
namespace: default
spec:
kubernetesConfig:
image: 'quay.io/opstree/redis:v6.2'
imagePullPolicy: IfNotPresent
redisSecret:
key: password
name: redis-secret
resources:
limits:
cpu: 101m
memory: 128Mi
requests:
cpu: 101m
memory: 128Mi
serviceType: LoadBalancer
storage:
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
redisExporter:
enabled: true
image: 'quay.io/opstree/redis-exporter:1.0'
imagePullPolicy: Always
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
redisConfig: {}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: etcd
name: redis
namespace: openshift-operators
spec:
channel: clusterwide-alpha
channel: stable
installPlanApproval: Automatic
name: etcd
name: redis-operator
source: community-operators
sourceNamespace: openshift-marketplace

0 comments on commit e50d881

Please sign in to comment.