diff --git a/tests/templates/kuttl/smoke/01-assert.yaml.j2 b/tests/templates/kuttl/smoke/01-assert.yaml.j2 new file mode 100644 index 0000000..92d3514 --- /dev/null +++ b/tests/templates/kuttl/smoke/01-assert.yaml.j2 @@ -0,0 +1,14 @@ +{% if test_scenario['values']['persistence'] == 'postgres' %} +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 600 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: postgresql +status: + readyReplicas: 1 + replicas: 1 +{% endif %} diff --git a/tests/templates/kuttl/smoke/01-install-postgres.yaml.j2 b/tests/templates/kuttl/smoke/01-install-postgres.yaml.j2 new file mode 100644 index 0000000..6e01e6d --- /dev/null +++ b/tests/templates/kuttl/smoke/01-install-postgres.yaml.j2 @@ -0,0 +1,14 @@ +{% if test_scenario['values']['persistence'] == 'postgres' %} +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +timeout: 300 +commands: + - script: >- + helm upgrade postgresql + --install + --version=12.5.6 + --namespace $NAMESPACE + -f 01_helm-bitnami-postgresql-values.yaml + --repo https://charts.bitnami.com/bitnami postgresql +{% endif %} diff --git a/tests/templates/kuttl/smoke/01_helm-bitnami-postgresql-values.yaml.j2 b/tests/templates/kuttl/smoke/01_helm-bitnami-postgresql-values.yaml.j2 new file mode 100644 index 0000000..9c9c701 --- /dev/null +++ b/tests/templates/kuttl/smoke/01_helm-bitnami-postgresql-values.yaml.j2 @@ -0,0 +1,42 @@ +--- +global: + security: + allowInsecureImages: true # needed starting with Chart version 16.3.0 if modifying images + +image: + repository: bitnamilegacy/postgresql + +volumePermissions: + enabled: false + image: + repository: bitnamilegacy/os-shell + securityContext: + runAsUser: auto + +metrics: + image: + repository: bitnamilegacy/postgres-exporter + +primary: + extendedConfiguration: | + password_encryption=md5 + podSecurityContext: +{% if test_scenario['values']['openshift'] == 'true' %} + enabled: false +{% else %} + enabled: true +{% endif %} + containerSecurityContext: + enabled: false + resources: + requests: + memory: "512Mi" + cpu: "512m" + limits: + memory: "512Mi" + cpu: "1" + +auth: + username: trino-lb + password: trino-lb + database: trino_lb diff --git a/tests/templates/kuttl/smoke/02-assert.yaml.j2 b/tests/templates/kuttl/smoke/02-assert.yaml.j2 new file mode 100644 index 0000000..0b67ec1 --- /dev/null +++ b/tests/templates/kuttl/smoke/02-assert.yaml.j2 @@ -0,0 +1,22 @@ +{% if test_scenario['values']['persistence'] == 'redis' %} +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 360 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: redis-master +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: redis-replicas +status: + readyReplicas: 1 + replicas: 1 +{% endif %} diff --git a/tests/templates/kuttl/smoke/02-install-redis.yaml.j2 b/tests/templates/kuttl/smoke/02-install-redis.yaml.j2 new file mode 100644 index 0000000..7cae0f0 --- /dev/null +++ b/tests/templates/kuttl/smoke/02-install-redis.yaml.j2 @@ -0,0 +1,14 @@ +{% if test_scenario['values']['persistence'] == 'redis' %} +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: >- + helm install redis + --namespace $NAMESPACE + --version 17.11.3 + -f 02_helm-bitnami-redis-values.yaml + --repo https://charts.bitnami.com/bitnami redis + --wait + timeout: 600 +{% endif %} diff --git a/tests/templates/kuttl/smoke/02_helm-bitnami-redis-values.yaml.j2 b/tests/templates/kuttl/smoke/02_helm-bitnami-redis-values.yaml.j2 new file mode 100644 index 0000000..293abaf --- /dev/null +++ b/tests/templates/kuttl/smoke/02_helm-bitnami-redis-values.yaml.j2 @@ -0,0 +1,63 @@ +--- +global: + security: + allowInsecureImages: true # needed starting with Chart version 20.5.0 if modifying images +image: + repository: bitnamilegacy/redis +sentinel: + image: + repository: bitnamilegacy/redis-sentinel +metrics: + image: + repository: bitnamilegacy/redis-exporter +kubectl: + image: + repository: bitnamilegacy/kubectl +sysctl: + image: + repository: bitnamilegacy/os-shell + +volumePermissions: + enabled: false + image: + repository: bitnamilegacy/os-shell + containerSecurityContext: + runAsUser: auto + +master: + podSecurityContext: +{% if test_scenario['values']['openshift'] == 'true' %} + enabled: false +{% else %} + enabled: true +{% endif %} + containerSecurityContext: + enabled: false + resources: + requests: + memory: "128Mi" + cpu: "200m" + limits: + memory: "128Mi" + cpu: "800m" + +replica: + replicaCount: 1 + podSecurityContext: +{% if test_scenario['values']['openshift'] == 'true' %} + enabled: false +{% else %} + enabled: true +{% endif %} + containerSecurityContext: + enabled: false + resources: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "128Mi" + cpu: "400m" + +auth: + password: redis diff --git a/tests/templates/kuttl/smoke/20_trino-lb-config.yaml.j2 b/tests/templates/kuttl/smoke/20_trino-lb-config.yaml.j2 index 2b15508..d4300b5 100644 --- a/tests/templates/kuttl/smoke/20_trino-lb-config.yaml.j2 +++ b/tests/templates/kuttl/smoke/20_trino-lb-config.yaml.j2 @@ -5,7 +5,15 @@ trinoLb: certPemFile: /certificates/cert.pem keyPemFile: /certificates/key.pem persistence: +{% if test_scenario['values']['persistence'] == 'inMemory' %} inMemory: {} +{% elif test_scenario['values']['persistence'] == 'redis' %} + redis: + endpoint: redis://:redis@redis-master:6379 +{% elif test_scenario['values']['persistence'] == 'postgres' %} + postgres: + url: postgres://trino-lb:trino-lb@postgresql/trino_lb +{% endif %} trinoClusterGroups: default: maxRunningQueries: 1 diff --git a/tests/templates/kuttl/smoke/40_trino-lb-config.yaml.j2 b/tests/templates/kuttl/smoke/40_trino-lb-config.yaml.j2 index 8f81c64..4c1a0b4 100644 --- a/tests/templates/kuttl/smoke/40_trino-lb-config.yaml.j2 +++ b/tests/templates/kuttl/smoke/40_trino-lb-config.yaml.j2 @@ -5,7 +5,15 @@ trinoLb: certPemFile: /certificates/cert.pem keyPemFile: /certificates/key.pem persistence: +{% if test_scenario['values']['persistence'] == 'inMemory' %} inMemory: {} +{% elif test_scenario['values']['persistence'] == 'redis' %} + redis: + endpoint: redis://:redis@redis-master:6379 +{% elif test_scenario['values']['persistence'] == 'postgres' %} + postgres: + url: postgres://trino-lb:trino-lb@postgresql/trino_lb +{% endif %} trinoClusterGroups: s: maxRunningQueries: 1 diff --git a/tests/test-definition.yaml b/tests/test-definition.yaml index 8210c0c..6959b54 100644 --- a/tests/test-definition.yaml +++ b/tests/test-definition.yaml @@ -6,7 +6,7 @@ dimensions: - name: trino values: - "451" - - "470" + # - "470" # Reduce test count - "476" # To use a custom image, add a comma and the full name after the product version # - 470,oci.stackable.tech/sdp/trino:470-stackable0.0.0-dev @@ -21,12 +21,17 @@ dimensions: values: - "true" - "false" + - name: persistence + values: + - inMemory + - redis + - postgres tests: - name: smoke dimensions: - trino-lb - trino + - persistence # TODOS -# 1. Test storage backend redis and postgres -# a. Also restart trino-lb deployment to make sure persistence is kept +# 1. Restart trino-lb deployment to make sure persistence is kept