Skip to content

Commit

Permalink
Integration tests (#337)
Browse files Browse the repository at this point in the history
* set dbname in postgres dbinstance

* teardown dbinstance and check for invalid database name earlier
  • Loading branch information
drewwells authored Oct 16, 2024
1 parent 1598f35 commit 62a4061
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/databaseclaim/awsprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ func (r *DatabaseClaimReconciler) managePostgresDBInstanceAWS(ctx context.Contex
MasterUserPasswordSecretRef: &dbMasterSecretInstance,
EngineVersion: ptr.To(getEngineVersion(params, r)),
},
DBName: &dbClaim.Spec.DatabaseName,
Engine: &params.Type,
MultiAZ: &multiAZ,
DBInstanceClass: &params.InstanceClass,
Expand Down Expand Up @@ -869,7 +870,7 @@ func (r *DatabaseClaimReconciler) updateDBInstance(ctx context.Context, reqInfo
} else {
maxStorageVal = &params.MaxStorageGB
}

dbInstance.Spec.ForProvider.DBName = &dbClaim.Spec.DatabaseName
dbInstance.Spec.ForProvider.MaxAllocatedStorage = maxStorageVal
dbInstance.Spec.ForProvider.EnableCloudwatchLogsExports = reqInfo.EnableCloudwatchLogsExport
dbInstance.Spec.ForProvider.MultiAZ = &multiAZ
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/dbc_end2end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var _ = Describe("dbc-end2end", Ordered, func() {
AppID: "sample-app",
DatabaseName: "sample_db",
SecretName: "newdb-secret-db1",
DeletionPolicy: "orphan",
DeletionPolicy: "delete",
Username: "sample_user",
Type: "postgres",
EnableReplicationRole: ptr.To(false),
Expand Down Expand Up @@ -141,7 +141,7 @@ var _ = Describe("dbc-end2end", Ordered, func() {
Eventually(func() string {
Expect(k8sClient.Get(ctx, key, dbClaim)).Should(Succeed())
return dbClaim.Status.Error
}, time.Minute*3, time.Second*3).ShouldNot(ContainSubstring(v1.ErrInvalidDBVersion.Error()))
}, time.Minute*3, time.Second*3).Should(ContainSubstring(v1.ErrInvalidDBVersion.Error()))

})

Expand All @@ -165,6 +165,7 @@ var _ = Describe("dbc-end2end", Ordered, func() {
Eventually(func() (v1.DbState, error) {
Expect(k8sClient.Get(ctx, key, updatedDbClaim)).ToNot(HaveOccurred())
Expect(updatedDbClaim.Spec.DBVersion).To(Equal(""))
Expect(updatedDbClaim.Status.Error).ShouldNot(ContainSubstring("does not exist"))
return updatedDbClaim.Status.ActiveDB.DbState, nil
}, timeout_e2e, interval_e2e).Should(Equal(v1.Ready))

Expand Down

0 comments on commit 62a4061

Please sign in to comment.