From 3cbeb7633b433d2109f903f0872443231b1c0269 Mon Sep 17 00:00:00 2001 From: Itay Grudev Date: Mon, 9 Sep 2024 03:36:09 +0300 Subject: [PATCH] Bug Fix: Test suite false positive --- .../04-data_write.yaml | 33 +++++++++++++++++- .../06-post_backup_data_write.yaml | 34 ++----------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/charts/cluster/test/paradedb-minio-backup-restore/04-data_write.yaml b/charts/cluster/test/paradedb-minio-backup-restore/04-data_write.yaml index f39fdb137..646c7e6de 100644 --- a/charts/cluster/test/paradedb-minio-backup-restore/04-data_write.yaml +++ b/charts/cluster/test/paradedb-minio-backup-restore/04-data_write.yaml @@ -1,3 +1,29 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: configmap-creator-sa +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: configmap-creator +rules: +- apiGroups: [""] + resources: ["configmaps"] + verbs: ["create"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: configmap-creator-binding +subjects: +- kind: ServiceAccount + name: configmap-creator-sa +roleRef: + kind: Role + name: configmap-creator + apiGroup: rbac.authorization.k8s.io +--- apiVersion: batch/v1 kind: Job metadata: @@ -5,6 +31,7 @@ metadata: spec: template: spec: + serviceAccountName: configmap-creator-sa restartPolicy: OnFailure containers: - name: data-write @@ -18,6 +45,10 @@ spec: command: ['sh', '-c'] args: - | - apk --no-cache add postgresql-client kubectl + apk --no-cache add postgresql-client kubectl coreutils DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) psql "$DB_URI" -c "CREATE TABLE mygoodtable (id serial PRIMARY KEY);" + sleep 5 + DATE_NO_BAD_TABLE=$(date --rfc-3339=ns) + kubectl create configmap date-no-bad-table --from-literal=date="$DATE_NO_BAD_TABLE" + sleep 5 diff --git a/charts/cluster/test/paradedb-minio-backup-restore/06-post_backup_data_write.yaml b/charts/cluster/test/paradedb-minio-backup-restore/06-post_backup_data_write.yaml index 405f45e58..7729a7c62 100644 --- a/charts/cluster/test/paradedb-minio-backup-restore/06-post_backup_data_write.yaml +++ b/charts/cluster/test/paradedb-minio-backup-restore/06-post_backup_data_write.yaml @@ -1,29 +1,3 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: configmap-creator-sa ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: configmap-creator -rules: -- apiGroups: [""] - resources: ["configmaps"] - verbs: ["create"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: configmap-creator-binding -subjects: -- kind: ServiceAccount - name: configmap-creator-sa -roleRef: - kind: Role - name: configmap-creator - apiGroup: rbac.authorization.k8s.io ---- apiVersion: batch/v1 kind: Job metadata: @@ -31,7 +5,6 @@ metadata: spec: template: spec: - serviceAccountName: configmap-creator-sa restartPolicy: OnFailure containers: - name: data-write @@ -49,9 +22,6 @@ spec: command: ['sh', '-c'] args: - | - apk --no-cache add postgresql-client kubectl coreutils + apk --no-cache add postgresql-client DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) - DATE_NO_BAD_TABLE=$(date --rfc-3339=ns) - sleep 30 - psql "$DB_URI" -c "CREATE TABLE mybadtable (id serial PRIMARY KEY);" - kubectl create configmap date-no-bad-table --from-literal=date="$DATE_NO_BAD_TABLE" + psql "$DB_URI" -c "CREATE TABLE mybadtable (id serial PRIMARY KEY);" \ No newline at end of file