4747import static oracle .weblogic .kubernetes .utils .CommonTestUtils .testUntil ;
4848import static oracle .weblogic .kubernetes .utils .CommonTestUtils .withStandardRetryPolicy ;
4949import static oracle .weblogic .kubernetes .utils .PodUtils .getExternalServicePodName ;
50+ import static oracle .weblogic .kubernetes .utils .PodUtils .getPodCreationTime ;
5051import static oracle .weblogic .kubernetes .utils .ThreadSafeLogger .getLogger ;
5152import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
5253import static org .junit .jupiter .api .Assertions .assertFalse ;
@@ -74,6 +75,8 @@ class ItMiiDynamicUpdatePart2 {
7475 public static Path pathToChangReadsYaml = null ;
7576 static LoggingFacade logger = null ;
7677
78+ static boolean isDataSourceCreated = false ;
79+
7780 /**
7881 * Install Operator.
7982 * Create domain resource defintion.
@@ -167,7 +170,7 @@ void testMiiDeleteAppChangeDBUrlWithCommitUpdateAndRoll() {
167170 assertNotEquals (-1 , adminServiceNodePort , "admin server default node port is not valid" );
168171 assertTrue (checkSystemResourceConfigViaAdminPod (helper .adminServerPodName , helper .domainNamespace ,
169172 "JDBCSystemResources/TestDataSource2/JDBCResource/JDBCDriverParams" ,
170- "newdburl " ), "JDBCSystemResource DB URL not found" );
173+ "jdbc:oracle:thin:@host:1234:sid " ), "JDBCSystemResource DB URL not found" );
171174 logger .info ("JDBCSystemResource DB URL found" );
172175
173176 // verify the application is undeployed
@@ -179,6 +182,7 @@ void testMiiDeleteAppChangeDBUrlWithCommitUpdateAndRoll() {
179182 // check that the domain status condition contains the correct type and expected reason
180183 logger .info ("verifying the domain status condition contains the correct type and expected status" );
181184 helper .verifyDomainStatusConditionNoErrorMsg ("Completed" , "True" );
185+ isDataSourceCreated = true ;
182186 }
183187
184188 /**
@@ -197,9 +201,18 @@ void testMiiDeleteDatasource() {
197201
198202 // This test uses the WebLogic domain created in BeforeAll method
199203 // BeforeEach method ensures that the server pods are running
200- LinkedHashMap <String , OffsetDateTime > pods =
201- helper .addDataSourceAndVerify (false );
202-
204+ LinkedHashMap <String , OffsetDateTime > pods = new LinkedHashMap ();
205+ if (!isDataSourceCreated ) {
206+ pods = helper .addDataSourceAndVerify (false );
207+ } else {
208+ // get the creation time of the admin server pod before patching
209+ pods .put (helper .adminServerPodName , getPodCreationTime (helper .domainNamespace , helper .adminServerPodName ));
210+ // get the creation time of the managed server pods before patching
211+ for (int i = 1 ; i <= helper .replicaCount ; i ++) {
212+ pods .put (helper .managedServerPrefix + i ,
213+ getPodCreationTime (helper .domainNamespace , helper .managedServerPrefix + i ));
214+ }
215+ }
203216 // write sparse yaml to delete datasource to file
204217 Path pathToDeleteDSYaml = Paths .get (WORK_DIR + "/deleteds.yaml" );
205218 String yamlToDeleteDS = "resources:\n "
0 commit comments