Skip to content

Commit 573d179

Browse files
committed
fix failing tests which depend on SchemaCreate
1 parent be7a252 commit 573d179

4 files changed

Lines changed: 16 additions & 33 deletions

File tree

operator/src/test/java/it/aboutbits/postgresql/_support/testdata/persisted/creator/DefaultPrivilegeCreate.java

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -234,29 +234,11 @@ private String getSchema() {
234234
return withSchema;
235235
}
236236

237-
var databaseName = getDatabase();
238-
if (databaseName.isBlank()) {
239-
databaseName = given.one()
240-
.database()
241-
.withClusterConnectionName(getClusterConnectionName())
242-
.withClusterConnectionNamespace(withClusterConnectionNamespace)
243-
.withReclaimPolicy(DELETE)
244-
.returnFirst()
245-
.getSpec()
246-
.getName();
247-
}
248-
249-
var clusterConnectionDb = given.one()
250-
.clusterConnection()
251-
.withName(getClusterConnectionName() + "-db")
252-
.withNamespace(withClusterConnectionNamespace)
253-
.withDatabase(databaseName)
254-
.returnFirst();
255-
256237
var item = given.one()
257238
.schema()
258-
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
259-
.withClusterConnectionNamespace(clusterConnectionDb.getMetadata().getNamespace())
239+
.withClusterConnectionName(getClusterConnectionName())
240+
.withClusterConnectionNamespace(withClusterConnectionNamespace)
241+
.withDatabase(getDatabase())
260242
.withReclaimPolicy(DELETE)
261243
.returnFirst();
262244

operator/src/test/java/it/aboutbits/postgresql/_support/testdata/persisted/creator/GrantCreate.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ private String getSchema() {
236236
return withSchema;
237237
}
238238

239-
var databaseName = getDatabase();
240-
if (databaseName.isBlank()) {
241-
databaseName = given.one()
239+
var database = getDatabase();
240+
if (database.isBlank()) {
241+
database = given.one()
242242
.database()
243243
.withClusterConnectionName(getClusterConnectionName())
244244
.withClusterConnectionNamespace(withClusterConnectionNamespace)
@@ -248,17 +248,11 @@ private String getSchema() {
248248
.getName();
249249
}
250250

251-
var clusterConnectionDb = given.one()
252-
.clusterConnection()
253-
.withName(getClusterConnectionName() + "-db")
254-
.withNamespace(withClusterConnectionNamespace)
255-
.withDatabase(databaseName)
256-
.returnFirst();
257-
258251
var item = given.one()
259252
.schema()
260-
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
261-
.withClusterConnectionNamespace(clusterConnectionDb.getMetadata().getNamespace())
253+
.withClusterConnectionName(getClusterConnectionName())
254+
.withClusterConnectionNamespace(withClusterConnectionNamespace)
255+
.withDatabase(database)
262256
.withReclaimPolicy(DELETE)
263257
.returnFirst();
264258

operator/src/test/java/it/aboutbits/postgresql/crd/defaultprivilege/DefaultPrivilegeReconcilerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ void defaultPrivilegeOnTable(
497497
var schema = given.one()
498498
.schema()
499499
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
500+
.withDatabase(database.getSpec().getName())
500501
.withReclaimPolicy(DELETE)
501502
.returnFirst();
502503

@@ -623,6 +624,7 @@ void defaultPrivilegeOnSequence() {
623624
var schema = given.one()
624625
.schema()
625626
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
627+
.withDatabase(database.getSpec().getName())
626628
.withReclaimPolicy(DELETE)
627629
.returnFirst();
628630

operator/src/test/java/it/aboutbits/postgresql/crd/grant/GrantReconcilerTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ void grantOnSchema() {
505505
var schema = given.one()
506506
.schema()
507507
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
508+
.withDatabase(database.getSpec().getName())
508509
.withReclaimPolicy(DELETE)
509510
.returnFirst();
510511

@@ -627,6 +628,7 @@ void grantOnTable(
627628
var schema = given.one()
628629
.schema()
629630
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
631+
.withDatabase(database.getSpec().getName())
630632
.withReclaimPolicy(DELETE)
631633
.returnFirst();
632634

@@ -762,6 +764,7 @@ void grantOnAllTables(
762764
var schema = given.one()
763765
.schema()
764766
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
767+
.withDatabase(database.getSpec().getName())
765768
.withReclaimPolicy(DELETE)
766769
.returnFirst();
767770

@@ -945,6 +948,7 @@ void grantOnSequence() {
945948
var schema = given.one()
946949
.schema()
947950
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
951+
.withDatabase(database.getSpec().getName())
948952
.withReclaimPolicy(DELETE)
949953
.returnFirst();
950954

@@ -1078,6 +1082,7 @@ void grantOnAllSequences() {
10781082
var schema = given.one()
10791083
.schema()
10801084
.withClusterConnectionName(clusterConnectionDb.getMetadata().getName())
1085+
.withDatabase(database.getSpec().getName())
10811086
.withReclaimPolicy(DELETE)
10821087
.returnFirst();
10831088

0 commit comments

Comments
 (0)