From e50d8813a5570eeb924742c4bd1ea472f09222a6 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Wed, 7 Jul 2021 15:28:35 +0530 Subject: [PATCH] Use redis operator for marketplace story 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 --- test/e2e/features/story_marketplace.feature | 35 ++++--------- test/testdata/etcd-cluster3.yaml | 12 ----- test/testdata/etcd-cluster5.yaml | 12 ----- test/testdata/redis-cluster.yaml | 49 +++++++++++++++++++ .../{etcdop-sub.yaml => redis-sub.yaml} | 6 +-- 5 files changed, 61 insertions(+), 53 deletions(-) delete mode 100644 test/testdata/etcd-cluster3.yaml delete mode 100644 test/testdata/etcd-cluster5.yaml create mode 100644 test/testdata/redis-cluster.yaml rename test/testdata/{etcdop-sub.yaml => redis-sub.yaml} (79%) diff --git a/test/e2e/features/story_marketplace.feature b/test/e2e/features/story_marketplace.feature index 407046d87f..b91e57c46e 100644 --- a/test/e2e/features/story_marketplace.feature +++ b/test/e2e/features/story_marketplace.feature @@ -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 @@ -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 @@ -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 diff --git a/test/testdata/etcd-cluster3.yaml b/test/testdata/etcd-cluster3.yaml deleted file mode 100644 index 28ebb25a47..0000000000 --- a/test/testdata/etcd-cluster3.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: etcd.database.coreos.com/v1beta2 -kind: EtcdCluster -metadata: - name: example - annotations: - etcd.database.coreos.com/scope: clusterwide - namespace: default -spec: - size: 3 - version: 3.2.13 - pod: - busyboxImage: quay.io/libpod/alpine:3.10.2 diff --git a/test/testdata/etcd-cluster5.yaml b/test/testdata/etcd-cluster5.yaml deleted file mode 100644 index a40f692912..0000000000 --- a/test/testdata/etcd-cluster5.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: etcd.database.coreos.com/v1beta2 -kind: EtcdCluster -metadata: - name: example - annotations: - etcd.database.coreos.com/scope: clusterwide - namespace: default -spec: - size: 5 - version: 3.2.13 - pod: - busyboxImage: quay.io/libpod/alpine:3.10.2 diff --git a/test/testdata/redis-cluster.yaml b/test/testdata/redis-cluster.yaml new file mode 100644 index 0000000000..fbb5e41e79 --- /dev/null +++ b/test/testdata/redis-cluster.yaml @@ -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: {} diff --git a/test/testdata/etcdop-sub.yaml b/test/testdata/redis-sub.yaml similarity index 79% rename from test/testdata/etcdop-sub.yaml rename to test/testdata/redis-sub.yaml index 8bdfd98450..dd82f6b88b 100644 --- a/test/testdata/etcdop-sub.yaml +++ b/test/testdata/redis-sub.yaml @@ -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