@@ -490,23 +490,7 @@ private void createJdbcResource() throws Exception {
490490 * @throws Exception when pods restart fail
491491 */
492492 private void recreateConfigMapandRestart (String oldSecret , String newSecret ) throws Exception {
493- // stop all running wls pods
494- int clusterReplicas =
495- TestUtils .getClusterReplicas (DOMAINUID , domain .getClusterName (), domain .getDomainNs ());
496-
497- // recreate the configmap with new overrride files
498- String cmd =
499- "kubectl create configmap "
500- + DOMAINUID
501- + "-sitconfigcm --from-file="
502- + configOverrideDir
503- + " -o yaml --dry-run | kubectl replace -f -" ;
504- TestUtils .exec (cmd , true );
505-
506- cmd = "kubectl describe cm -n " + domain .getDomainNs () + " customsitconfigdomain-sitconfigcm" ;
507- TestUtils .exec (cmd , true );
508-
509- // now modify the domain.yaml if the secret name is changed
493+ // modify the domain.yaml if the secret name is changed
510494 if (!oldSecret .equals (newSecret )) {
511495 String content =
512496 new String (Files .readAllBytes (Paths .get (domainYaml )), StandardCharsets .UTF_8 );
@@ -515,31 +499,43 @@ private void recreateConfigMapandRestart(String oldSecret, String newSecret) thr
515499 Paths .get (domainYaml ),
516500 content .getBytes (StandardCharsets .UTF_8 ),
517501 StandardOpenOption .TRUNCATE_EXISTING );
518- logger .log (Level .INFO , content );
519502
520503 // delete the old secret and add new secret to domain.yaml
521504 TestUtils .exec ("kubectl delete secret " + domain .getDomainUid () + "-" + oldSecret , true );
522- cmd =
505+ String cmd =
523506 "kubectl -n "
524507 + domain .getDomainNs ()
525508 + " create secret generic "
526509 + domain .getDomainUid ()
527510 + "-"
528511 + newSecret
529512 + " --from-literal=hostname="
530- + fqdn
513+ + TestUtils . getHostName ()
531514 + " --from-literal=dbusername=root"
532515 + " --from-literal=dbpassword=root123" ;
533516 TestUtils .exec (cmd , true );
534- // apply the new domain.yaml
535517 TestUtils .exec ("kubectl apply -f " + domainYaml , true );
536518 }
519+
520+ int clusterReplicas =
521+ TestUtils .getClusterReplicas (DOMAINUID , domain .getClusterName (), domain .getDomainNs ());
522+
537523 // restart the pods so that introspector can run and replace files with new secret if changed
538524 // and with new config override files
539525 String patchStr = "'{\" spec\" :{\" serverStartPolicy\" :\" NEVER\" }}'" ;
540526 TestUtils .kubectlpatch (DOMAINUID , domain .getDomainNs (), patchStr );
541527 domain .verifyServerPodsDeleted (clusterReplicas );
542- TestUtils .exec ("kubectl get all --all-namespaces" , true );
528+
529+ String cmd =
530+ "kubectl create configmap "
531+ + DOMAINUID
532+ + "-sitconfigcm --from-file="
533+ + configOverrideDir
534+ + " -o yaml --dry-run | kubectl replace -f -" ;
535+ TestUtils .exec (cmd , true );
536+ cmd = "kubectl describe cm -n " + domain .getDomainNs () + " customsitconfigdomain-sitconfigcm" ;
537+ TestUtils .exec (cmd , true );
538+
543539 patchStr = "'{\" spec\" :{\" serverStartPolicy\" :\" IF_NEEDED\" }}'" ;
544540 TestUtils .kubectlpatch (DOMAINUID , domain .getDomainNs (), patchStr );
545541 domain .verifyDomainCreated ();
0 commit comments