Change postgres image for Operator tests

Closes #22032
This commit is contained in:
Václav Muzikář 2023-07-27 15:42:51 +02:00 committed by Alexander Schwartz
parent bbc66ad580
commit cce0778886
3 changed files with 21 additions and 12 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: keycloak-db-secret name: keycloak-db-secret
data: stringData:
username: cG9zdGdyZXM= # postgres username: "kc-user"
password: dGVzdHBhc3N3b3Jk # testpassword password: "testpassword"
type: Opaque type: Opaque

View file

@ -16,16 +16,25 @@ spec:
spec: spec:
containers: containers:
- name: postgresql-db - name: postgresql-db
image: postgres:latest # WARN: this image is not ARM64 native, consider using "postgres:latest" or "registry.redhat.io/rhel9/postgresql-15:latest" if you need that
# See also https://github.com/sclorg/postgresql-container/pull/527
# Using c8s instead of c9s as c9s requires additional arguments for emulation on ARM machines, while c8s works OOTB
image: quay.io/sclorg/postgresql-15-c8s:latest
volumeMounts: volumeMounts:
- mountPath: /data - mountPath: /var/lib/pgsql/data
name: cache-volume name: cache-volume
env: env:
- name: POSTGRES_PASSWORD - name: POSTGRESQL_USER
value: testpassword valueFrom:
- name: PGDATA secretKeyRef:
value: /data/pgdata key: username
- name: POSTGRES_DB name: keycloak-db-secret
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: keycloak-db-secret
- name: POSTGRESQL_DATABASE
value: keycloak value: keycloak
volumes: volumes:
- name: cache-volume - name: cache-volume

View file

@ -183,6 +183,8 @@ public class BaseOperatorTest implements QuarkusTestAfterEachCallback {
} }
protected static void deployDB() { protected static void deployDB() {
deployDBSecret();
// DB // DB
Log.info("Creating new PostgreSQL deployment"); Log.info("Creating new PostgreSQL deployment");
K8sUtils.set(k8sclient, BaseOperatorTest.class.getResourceAsStream("/example-postgres.yaml")); K8sUtils.set(k8sclient, BaseOperatorTest.class.getResourceAsStream("/example-postgres.yaml"));
@ -191,8 +193,6 @@ public class BaseOperatorTest implements QuarkusTestAfterEachCallback {
Log.info("Checking Postgres is running"); Log.info("Checking Postgres is running");
Awaitility.await() Awaitility.await()
.untilAsserted(() -> assertThat(k8sclient.apps().statefulSets().inNamespace(namespace).withName("postgresql-db").get().getStatus().getReadyReplicas()).isEqualTo(1)); .untilAsserted(() -> assertThat(k8sclient.apps().statefulSets().inNamespace(namespace).withName("postgresql-db").get().getStatus().getReadyReplicas()).isEqualTo(1));
deployDBSecret();
} }
protected static void deployDBSecret() { protected static void deployDBSecret() {