Skip to content

Commit b56607c

Browse files
authored
create pv and pvc objects with unique names to reduce failures due to (#2837)
leftover resources
1 parent b7186f8 commit b56607c

17 files changed

+115
-47
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItConfigDistributionStrategy.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
9696
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
9797
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
98+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
9899
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDoesNotExist;
99100
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodExists;
100101
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodReady;
@@ -130,8 +131,8 @@ class ItConfigDistributionStrategy {
130131
final String managedServerNameBase = "ms-";
131132
final int managedServerPort = 8001;
132133
int t3ChannelPort;
133-
final String pvName = domainUid + "-pv"; // name of the persistent volume
134-
final String pvcName = domainUid + "-pvc"; // name of the persistent volume claim
134+
final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
135+
final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
135136
final String wlSecretName = "weblogic-credentials";
136137
final String managedServerPodNamePrefix = domainUid + "-" + managedServerNameBase;
137138
int replicaCount = 2;

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItFmwDomainInPVUsingWDT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
4646
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
4747
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
48+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
4849
import static oracle.weblogic.kubernetes.utils.PodUtils.setPodAntiAffinity;
4950
import static oracle.weblogic.kubernetes.utils.SecretUtils.createSecretWithUsernamePassword;
5051
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
@@ -151,8 +152,8 @@ RCUSCHEMAPREFIX, dbNamespace, getNextFreePort(), dbUrl, dbListenerPort),
151152
@Test
152153
@DisplayName("Create a FMW domainon on PV using WDT")
153154
void testFmwDomainOnPVUsingWdt() {
154-
final String pvName = domainUid + "-" + domainNamespace + "-pv";
155-
final String pvcName = domainUid + "-" + domainNamespace + "-pvc";
155+
final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
156+
final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
156157
final int t3ChannelPort = getNextFreePort();
157158

158159
// create FMW domain credential secret

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItFmwDomainInPVUsingWLST.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
5858
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
5959
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
60+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
6061
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodReady;
6162
import static oracle.weblogic.kubernetes.utils.PodUtils.setPodAntiAffinity;
6263
import static oracle.weblogic.kubernetes.utils.SecretUtils.createSecretWithUsernamePassword;
@@ -159,8 +160,8 @@ void testFmwDomainInPvUsingWlst() {
159160
final int replicaCount = 2;
160161
final int t3ChannelPort = getNextFreePort();
161162

162-
final String pvName = domainUid + "-pv";
163-
final String pvcName = domainUid + "-pvc";
163+
final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
164+
final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
164165

165166
// create pull secrets for jrfDomainNamespace when running in non Kind Kubernetes cluster
166167
// this secret is used only for non-kind cluster

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItFmwDynamicDomainInPV.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
6060
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
6161
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
62+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
6263
import static oracle.weblogic.kubernetes.utils.PodUtils.getExternalServicePodName;
6364
import static oracle.weblogic.kubernetes.utils.PodUtils.setPodAntiAffinity;
6465
import static oracle.weblogic.kubernetes.utils.SecretUtils.createSecretWithUsernamePassword;
@@ -162,8 +163,8 @@ void testFmwDynamicDomainInPV() {
162163
}
163164

164165
private void createFmwDomainAndVerify() {
165-
final String pvName = domainUid + "-" + domainNamespace + "-pv";
166-
final String pvcName = domainUid + "-" + domainNamespace + "-pvc";
166+
final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
167+
final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
167168
final int t3ChannelPort = getNextFreePort();
168169

169170
// create pull secrets for domainNamespace when running in non Kind Kubernetes cluster

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIntrospectVersion.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
import static oracle.weblogic.kubernetes.utils.PatchDomainUtils.patchDomainResource;
110110
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
111111
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
112+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
112113
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDoesNotExist;
113114
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodExists;
114115
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodReady;
@@ -228,8 +229,8 @@ void testDomainIntrospectVersionNotRolling() {
228229

229230
final int t3ChannelPort = getNextFreePort();
230231

231-
final String pvName = domainUid + "-pv"; // name of the persistent volume
232-
final String pvcName = domainUid + "-pvc"; // name of the persistent volume claim
232+
final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
233+
final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
233234

234235
// create WebLogic domain credential secret
235236
createSecretWithUsernamePassword(wlSecretName, introDomainNamespace,

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInPV.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
import static oracle.weblogic.kubernetes.utils.PatchDomainUtils.patchServerStartPolicy;
7070
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
7171
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
72+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
7273
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDeleted;
7374
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodReady;
7475
import static oracle.weblogic.kubernetes.utils.PodUtils.setPodAntiAffinity;
@@ -152,8 +153,8 @@ void testIstioDomainHomeInPv() {
152153
final int replicaCount = 2;
153154
final int t3ChannelPort = getNextFreePort();
154155

155-
final String pvName = domainUid + "-pv"; // name of the persistent volume
156-
final String pvcName = domainUid + "-pvc"; // name of the persistent volume claim
156+
final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
157+
final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
157158

158159
// create pull secrets for WebLogic image when running in non Kind Kubernetes cluster
159160
// this secret is used only for non-kind cluster

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItKubernetesEvents.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
import static oracle.weblogic.kubernetes.utils.PatchDomainUtils.patchDomainResource;
105105
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
106106
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
107+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
107108
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDoesNotExist;
108109
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodExists;
109110
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodReady;
@@ -153,8 +154,8 @@ class ItKubernetesEvents {
153154
final int managedServerPort = 8001;
154155
int replicaCount = 2;
155156

156-
final String pvName = domainUid + "-pv"; // name of the persistent volume
157-
final String pvcName = domainUid + "-pvc"; // name of the persistent volume claim
157+
final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
158+
final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
158159
private static final String domainUid = "k8seventsdomain";
159160
private final String wlSecretName = "weblogic-credentials";
160161

@@ -496,8 +497,10 @@ void testDomainK8sEventsScaleBelowMin() {
496497
void testDomainK8sEventsProcessingFailed() {
497498
OffsetDateTime timestamp = now();
498499
try {
499-
createPV("sample-pv", domainUid, this.getClass().getSimpleName());
500-
createPVC("sample-pv", "sample-pvc", domainUid, domainNamespace1);
500+
String pvName = getUniquePvOrPvcName("sample-pv-");
501+
String pvcName = getUniquePvOrPvcName("sample-pvc-");
502+
createPV(pvName, domainUid, this.getClass().getSimpleName());
503+
createPVC(pvName, pvcName, domainUid, domainNamespace1);
501504
String introspectVersion = assertDoesNotThrow(() -> getNextIntrospectVersion(domainUid, domainNamespace1));
502505
String patchStr
503506
= "["

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiCustomSslStore.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
4343
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
4444
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
45+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
4546
import static oracle.weblogic.kubernetes.utils.SslUtils.generateJksStores;
4647
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
4748
import static org.awaitility.Awaitility.with;
@@ -53,14 +54,14 @@
5354
* This test class verifies usage of CustomIdentityCustomTrust on PV.
5455
* Create an MII domain with an attached persistent volume.
5556
* Configure custom identity and custom trust on server template
56-
* Don't explicitly set the SSL port on the server template.
57+
* Don't explicitly set the SSL port on the server template.
5758
* The default will be set to 8100.
58-
* Put the IdentityKeyStore.jks and TrustKeyStore.jks on /shared directory
59-
* after administration server pod is started so that it can be accessible
59+
* Put the IdentityKeyStore.jks and TrustKeyStore.jks on /shared directory
60+
* after administration server pod is started so that it can be accessible
6061
* from all managed server pods
61-
* Once all servers are started get the JNDI initial context using cluster
62+
* Once all servers are started get the JNDI initial context using cluster
6263
* service URL with t3s protocol.
63-
* Repeat the same after scaling the cluster
64+
* Repeat the same after scaling the cluster
6465
*/
6566

6667
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@@ -73,8 +74,8 @@ class ItMiiCustomSslStore {
7374
private static ConditionFactory withStandardRetryPolicy = null;
7475
private static int replicaCount = 2;
7576
private static final String domainUid = "mii-custom-ssl";
76-
private static String pvName = domainUid + "-pv";
77-
private static String pvcName = domainUid + "-pvc";
77+
private static final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
78+
private static final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
7879
private static final String adminServerPodName = domainUid + "-admin-server";
7980
private static final String managedServerPrefix = domainUid + "-managed-server";
8081
private static LoggingFacade logger = null;
@@ -83,7 +84,7 @@ class ItMiiCustomSslStore {
8384
/**
8485
* Install Operator.
8586
* Create domain resource definition.
86-
* @param namespaces list of namespaces created by the IntegrationTestWatcher by the
87+
* @param namespaces list of namespaces created by the IntegrationTestWatcher by the
8788
* JUnit engine parameter resolution mechanism
8889
*/
8990
@BeforeAll
@@ -102,7 +103,7 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
102103
logger.info("Creating unique namespace for Domain");
103104
assertNotNull(namespaces.get(1), "Namespace list is null");
104105
domainNamespace = namespaces.get(1);
105-
106+
106107
// Create the repo secret to pull the image
107108
// this secret is used only for non-kind cluster
108109
createOcirRepoSecret(domainNamespace);
@@ -111,11 +112,11 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
111112
installAndVerifyOperator(opNamespace, domainNamespace);
112113

113114
// create secret for admin credential with special characters
114-
// the resultant password is ##W%*}!"'"`']\\\\//1$$~x
115+
// the resultant password is ##W%*}!"'"`']\\\\//1$$~x
115116
// let the user name be something other than weblogic say wlsadmin
116117
logger.info("Create secret for admin credentials");
117118
String adminSecretName = "weblogic-credentials";
118-
assertDoesNotThrow(() -> createDomainSecret(adminSecretName,
119+
assertDoesNotThrow(() -> createDomainSecret(adminSecretName,
119120
"wlsadmin", "##W%*}!\"'\"`']\\\\//1$$~x", domainNamespace),
120121
String.format("createSecret failed for %s", adminSecretName));
121122

@@ -163,7 +164,7 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
163164
logger.info("Check admin service and pod {0} is created in namespace {1}",
164165
adminServerPodName, domainNamespace);
165166
checkPodReadyAndServiceExists(adminServerPodName, domainUid, domainNamespace);
166-
// Generate JKS Keystore using openssl before
167+
// Generate JKS Keystore using openssl before
167168
// managed server services and pods are ready
168169
generateJksStores();
169170
assertDoesNotThrow(() -> copyFileToPod(domainNamespace,
@@ -190,15 +191,15 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
190191
@Order(1)
191192
@DisplayName("Verify JNDI Context can be accessed using t3s cluster URL")
192193
void testMiiGetCustomSSLContext() {
193-
194+
194195
// build the standalone Client on Admin pod after rolling restart
195196
String destLocation = "/u01/SslTestClient.java";
196197
assertDoesNotThrow(() -> copyFileToPod(domainNamespace,
197198
adminServerPodName, "",
198199
Paths.get(RESOURCE_DIR, "ssl", "SslTestClient.java"),
199200
Paths.get(destLocation)));
200201
runJavacInsidePod(adminServerPodName, domainNamespace, destLocation);
201-
202+
202203
runClientOnAdminPod();
203204

204205
boolean psuccess = assertDoesNotThrow(() ->

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDomainModelInPV.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
8080
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
8181
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createfixPVCOwnerContainer;
82+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
8283
import static oracle.weblogic.kubernetes.utils.PodUtils.execInPod;
8384
import static oracle.weblogic.kubernetes.utils.PodUtils.getExternalServicePodName;
8485
import static oracle.weblogic.kubernetes.utils.SecretUtils.createSecretWithUsernamePassword;
@@ -114,8 +115,8 @@ public class ItMiiDomainModelInPV {
114115
private static String adminSecretName;
115116
private static String encryptionSecretName;
116117

117-
private static String pvName = domainUid1 + "-wdtmodel-pv"; // name of the persistent volume
118-
private static String pvcName = domainUid1 + "-wdtmodel-pvc"; // name of the persistent volume claim
118+
private static final String pvName = getUniquePvOrPvcName(domainUid1 + "-wdtmodel-pv-");
119+
private static final String pvcName = getUniquePvOrPvcName(domainUid1 + "-wdtmodel-pvc-");
119120

120121
private static Path clusterViewAppPath;
121122
private static String modelFile = "modelinpv-with-war.yaml";

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDynamicUpdate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
import static oracle.weblogic.kubernetes.utils.PatchDomainUtils.patchDomainResourceWithNewReplicaCountAtSpecLevel;
9090
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPV;
9191
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createPVC;
92+
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.getUniquePvOrPvcName;
9293
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDeleted;
9394
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDoesNotExist;
9495
import static oracle.weblogic.kubernetes.utils.PodUtils.getExternalServicePodName;
@@ -123,8 +124,8 @@ class ItMiiDynamicUpdate {
123124
private static ConditionFactory withQuickRetryPolicy;
124125
private static int replicaCount = 2;
125126
private static final String domainUid = "mii-dynamic-update";
126-
private static String pvName = domainUid + "-pv"; // name of the persistent volume
127-
private static String pvcName = domainUid + "-pvc"; // name of the persistent volume claim
127+
private static final String pvName = getUniquePvOrPvcName(domainUid + "-pv-");
128+
private static final String pvcName = getUniquePvOrPvcName(domainUid + "-pvc-");
128129
private static final String configMapName = "dynamicupdate-test-configmap";
129130
private final String adminServerPodName = domainUid + "-admin-server";
130131
private final String managedServerPrefix = domainUid + "-managed-server";

0 commit comments

Comments
 (0)