-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from vshn/e2e
Add e2e test case for PostgreSQL
- Loading branch information
Showing
12 changed files
with
156 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 600 | ||
--- | ||
apiVersion: exoscale.crossplane.io/v1 | ||
kind: PostgreSQL | ||
metadata: | ||
name: e2e-test-postgresql | ||
annotations: | ||
crossplane.io/external-name: e2e-test-postgresql | ||
finalizers: | ||
- finalizer.managedresource.crossplane.io | ||
spec: | ||
forProvider: | ||
backup: | ||
timeOfDay: '13:00:00' | ||
ipFilter: | ||
- 0.0.0.0/0 | ||
maintenance: | ||
dayOfWeek: monday | ||
timeOfDay: '12:00:00' | ||
size: | ||
plan: hobbyist-2 | ||
version: '14' | ||
zone: ch-dk-2 | ||
pgSettings: | ||
timezone: Europe/Zurich | ||
providerConfigRef: | ||
name: provider-config | ||
writeConnectionSecretToRef: | ||
name: e2e-test-postgresql-details | ||
namespace: default | ||
status: | ||
atProvider: | ||
backup: | ||
timeOfDay: '13:00:00' | ||
maintenance: | ||
dayOfWeek: monday | ||
timeOfDay: '12:00:00' | ||
noteStates: | ||
- name: e2e-test-postgresql-1 | ||
role: master | ||
state: running | ||
conditions: | ||
- message: The service is running | ||
reason: Available | ||
status: 'True' | ||
type: Ready | ||
- reason: ReconcileSuccess | ||
status: 'True' | ||
type: Synced | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
type: connection.crossplane.io/v1alpha1 | ||
metadata: | ||
name: e2e-test-postgresql-details | ||
namespace: default | ||
ownerReferences: | ||
- apiVersion: exoscale.crossplane.io/v1 | ||
kind: PostgreSQL | ||
name: e2e-test-postgresql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: exoscale.crossplane.io/v1 | ||
kind: PostgreSQL | ||
metadata: | ||
name: e2e-test-postgresql | ||
spec: | ||
forProvider: | ||
backup: | ||
timeOfDay: "13:00:00" | ||
ipFilter: | ||
- 0.0.0.0/0 | ||
maintenance: | ||
dayOfWeek: monday | ||
timeOfDay: "12:00:00" | ||
size: | ||
plan: hobbyist-2 | ||
version: "14" | ||
zone: ch-dk-2 | ||
pgSettings: | ||
timezone: Europe/Zurich | ||
providerConfigRef: | ||
name: provider-config | ||
writeConnectionSecretToRef: | ||
name: e2e-test-postgresql-details | ||
namespace: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: connect-postgresql | ||
namespace: default | ||
status: | ||
conditions: | ||
- type: Complete | ||
status: 'True' | ||
succeeded: 1 | ||
ready: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: connect-postgresql | ||
namespace: default | ||
spec: | ||
backoffLimit: 5 | ||
template: | ||
metadata: | ||
labels: | ||
e2e-test: postgresql | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: connect | ||
image: docker.io/bitnami/postgresql:latest | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- bash | ||
securityContext: | ||
# with an arbitrary user, "psql" complains it can't find the user ID. | ||
# For e2e test using root should be ok | ||
runAsUser: 0 | ||
args: | ||
- -c | ||
- echo "Testing Select...\n" && PGDATABASE="$POSTGRESQL_DB" PGUSER="$POSTGRESQL_USER" PGPASSWORD="$POSTGRESQL_PASSWORD" PGHOST="$POSTGRESQL_HOST" PGPORT="$POSTGRESQL_PORT" psql -c "select 1;" | ||
env: | ||
- name: PGSSLMODE | ||
value: verify-ca | ||
envFrom: | ||
- secretRef: | ||
name: e2e-test-postgresql-details | ||
volumeMounts: | ||
- name: ca | ||
mountPath: /root/.postgresql | ||
volumes: | ||
- name: ca | ||
secret: | ||
secretName: e2e-test-postgresql-details | ||
items: | ||
- key: ca.crt | ||
path: root.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
delete: | ||
# This will wait until resources are really gone | ||
- apiVersion: batch/v1 | ||
kind: Job | ||
name: connect-postgresql | ||
- apiVersion: v1 | ||
kind: Pod | ||
labels: | ||
e2e-test: postgresql | ||
- apiVersion: exoscale.crossplane.io/v1 | ||
kind: PostgreSQL | ||
name: e2e-test-postgresql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters