Skip to content

Commit

Permalink
Bug Fix: Test suite false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
itay-grudev committed Sep 9, 2024
1 parent d03fc8d commit 3cbeb76
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
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:
name: data-write
spec:
template:
spec:
serviceAccountName: configmap-creator-sa
restartPolicy: OnFailure
containers:
- name: data-write
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
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:
name: data-write-post-backup
spec:
template:
spec:
serviceAccountName: configmap-creator-sa
restartPolicy: OnFailure
containers:
- name: data-write
Expand All @@ -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);"

0 comments on commit 3cbeb76

Please sign in to comment.