Skip to content

Commit 544360c

Browse files
author
Fred Campos
committed
Moved AdminSecretExclusivity to CRDValidation class
1 parent b335a78 commit 544360c

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

operator/src/test/java/it/aboutbits/postgresql/crd/clusterconnection/ClusterConnectionReconcilerTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.quarkus.test.junit.QuarkusTest;
66
import it.aboutbits.postgresql._support.testdata.base.TestUtil;
77
import it.aboutbits.postgresql._support.testdata.persisted.Given;
8+
import it.aboutbits.postgresql._support.valuesource.BlankSource;
89
import it.aboutbits.postgresql.core.CRPhase;
910
import it.aboutbits.postgresql.core.CRStatus;
1011
import it.aboutbits.postgresql.core.FileRef;
@@ -18,6 +19,7 @@
1819
import org.junit.jupiter.api.DisplayName;
1920
import org.junit.jupiter.api.Nested;
2021
import org.junit.jupiter.api.Test;
22+
import org.junit.jupiter.params.ParameterizedTest;
2123

2224
import java.io.IOException;
2325
import java.nio.file.Files;
@@ -129,8 +131,7 @@ void createsCustomResourceWithFileRef_andReconcilerStatusIsReady() throws IOExce
129131
}
130132

131133
@Nested
132-
@DisplayName("CRD Validation: AdminSecret Exclusivity")
133-
class AdminSecretExclusivity {
134+
class CRDValidation {
134135
@Test
135136
@DisplayName("when both adminSecretRef and adminSecretFileRef set, should reject")
136137
void whenBothSet_shouldReject() {
@@ -156,11 +157,12 @@ void whenNeitherSet_shouldReject() {
156157
.hasMessageContaining("Exactly one of");
157158
}
158159

159-
@Test
160+
@ParameterizedTest
161+
@BlankSource
160162
@DisplayName("when adminSecretFileRef has blank path, should reject")
161-
void whenFileRefBlankPath_shouldReject() {
163+
void whenFileRefBlankPath_shouldReject(String blankOrEmptyString) {
162164
var fileRef = new FileRef();
163-
fileRef.setPath(" ");
165+
fileRef.setPath(blankOrEmptyString);
164166

165167
assertThatThrownBy(() -> given.one()
166168
.clusterConnection()

0 commit comments

Comments
 (0)