47
47
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .testUntil ;
48
48
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .withStandardRetryPolicy ;
49
49
import static oracle .weblogic .kubernetes .utils .PodUtils .getExternalServicePodName ;
50
+ import static oracle .weblogic .kubernetes .utils .PodUtils .getPodCreationTime ;
50
51
import static oracle .weblogic .kubernetes .utils .ThreadSafeLogger .getLogger ;
51
52
import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
52
53
import static org .junit .jupiter .api .Assertions .assertFalse ;
@@ -74,6 +75,8 @@ class ItMiiDynamicUpdatePart2 {
74
75
public static Path pathToChangReadsYaml = null ;
75
76
static LoggingFacade logger = null ;
76
77
78
+ static boolean isDataSourceCreated = false ;
79
+
77
80
/**
78
81
* Install Operator.
79
82
* Create domain resource defintion.
@@ -167,7 +170,7 @@ void testMiiDeleteAppChangeDBUrlWithCommitUpdateAndRoll() {
167
170
assertNotEquals (-1 , adminServiceNodePort , "admin server default node port is not valid" );
168
171
assertTrue (checkSystemResourceConfigViaAdminPod (helper .adminServerPodName , helper .domainNamespace ,
169
172
"JDBCSystemResources/TestDataSource2/JDBCResource/JDBCDriverParams" ,
170
- "newdburl " ), "JDBCSystemResource DB URL not found" );
173
+ "jdbc:oracle:thin:@host:1234:sid " ), "JDBCSystemResource DB URL not found" );
171
174
logger .info ("JDBCSystemResource DB URL found" );
172
175
173
176
// verify the application is undeployed
@@ -179,6 +182,7 @@ void testMiiDeleteAppChangeDBUrlWithCommitUpdateAndRoll() {
179
182
// check that the domain status condition contains the correct type and expected reason
180
183
logger .info ("verifying the domain status condition contains the correct type and expected status" );
181
184
helper .verifyDomainStatusConditionNoErrorMsg ("Completed" , "True" );
185
+ isDataSourceCreated = true ;
182
186
}
183
187
184
188
/**
@@ -197,9 +201,18 @@ void testMiiDeleteDatasource() {
197
201
198
202
// This test uses the WebLogic domain created in BeforeAll method
199
203
// 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
+ }
203
216
// write sparse yaml to delete datasource to file
204
217
Path pathToDeleteDSYaml = Paths .get (WORK_DIR + "/deleteds.yaml" );
205
218
String yamlToDeleteDS = "resources:\n "
0 commit comments