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
metadata:
name: keycloak-db-secret
data:
username: cG9zdGdyZXM= # postgres
password: dGVzdHBhc3N3b3Jk # testpassword
stringData:
username: "kc-user"
password: "testpassword"
type: Opaque

View file

@ -16,16 +16,25 @@ spec:
spec:
containers:
- 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:
- mountPath: /data
- mountPath: /var/lib/pgsql/data
name: cache-volume
env:
- name: POSTGRES_PASSWORD
value: testpassword
- name: PGDATA
value: /data/pgdata
- name: POSTGRES_DB
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
key: username
name: keycloak-db-secret
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: keycloak-db-secret
- name: POSTGRESQL_DATABASE
value: keycloak
volumes:
- name: cache-volume

View file

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