17
17
import io .kubernetes .client .openapi .models .V1EnvVar ;
18
18
import io .kubernetes .client .openapi .models .V1LocalObjectReference ;
19
19
import io .kubernetes .client .openapi .models .V1ObjectMeta ;
20
+ import io .kubernetes .client .openapi .models .V1Pod ;
20
21
import io .kubernetes .client .openapi .models .V1Secret ;
21
22
import io .kubernetes .client .openapi .models .V1SecretReference ;
22
23
import io .kubernetes .client .openapi .models .V1ServiceAccount ;
36
37
import oracle .weblogic .kubernetes .annotations .tags .MustNotRunInParallel ;
37
38
import oracle .weblogic .kubernetes .annotations .tags .Slow ;
38
39
import oracle .weblogic .kubernetes .extensions .LoggedTest ;
40
+ import oracle .weblogic .kubernetes .utils .ExecResult ;
39
41
import org .awaitility .core .ConditionFactory ;
40
42
import org .junit .jupiter .api .AfterAll ;
41
43
import org .junit .jupiter .api .BeforeAll ;
74
76
import static oracle .weblogic .kubernetes .actions .TestActions .deleteServiceAccount ;
75
77
import static oracle .weblogic .kubernetes .actions .TestActions .dockerLogin ;
76
78
import static oracle .weblogic .kubernetes .actions .TestActions .dockerPush ;
79
+ import static oracle .weblogic .kubernetes .actions .TestActions .execCommand ;
77
80
import static oracle .weblogic .kubernetes .actions .TestActions .getOperatorImageName ;
78
81
import static oracle .weblogic .kubernetes .actions .TestActions .installOperator ;
79
82
import static oracle .weblogic .kubernetes .actions .TestActions .uninstallOperator ;
88
91
import static oracle .weblogic .kubernetes .utils .FileUtils .checkDirectory ;
89
92
import static org .awaitility .Awaitility .with ;
90
93
import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
94
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
91
95
import static org .junit .jupiter .api .Assertions .assertFalse ;
92
96
import static org .junit .jupiter .api .Assertions .assertNotNull ;
93
97
import static org .junit .jupiter .api .Assertions .assertTrue ;
98
+ import static org .junit .jupiter .api .Assertions .fail ;
94
99
95
100
// Test to create model in image domain and verify the domain started successfully
96
101
@ TestMethodOrder (MethodOrderer .OrderAnnotation .class )
@@ -107,6 +112,8 @@ class ItMiiDomain implements LoggedTest {
107
112
private static final String DOMAIN_VERSION = "v7" ;
108
113
private static final String API_VERSION = "weblogic.oracle/" + DOMAIN_VERSION ;
109
114
115
+ private static final String READ_STATE_COMMAND = "/weblogic-operator/scripts/readState.sh" ;
116
+
110
117
private static HelmParams opHelmParams = null ;
111
118
private static V1ServiceAccount serviceAccount = null ;
112
119
private String serviceAccountName = null ;
@@ -300,6 +307,9 @@ public void testCreateMiiDomain() {
300
307
adminServerPodName , domainNamespace );
301
308
checkPodReady (adminServerPodName , domainUid , domainNamespace );
302
309
310
+ logger .info ("Check admin server status by calling read state command" );
311
+ checkServerReadyStatusByExec (adminServerPodName , domainNamespace );
312
+
303
313
// check managed server pods are ready
304
314
for (int i = 1 ; i <= replicaCount ; i ++) {
305
315
logger .info ("Wait for managed server pod {0} to be ready in namespace {1}" ,
@@ -757,4 +767,23 @@ private void checkServiceCreated(String serviceName, String domNamespace) {
757
767
758
768
}
759
769
770
+ private void checkServerReadyStatusByExec (String podName , String namespace ) {
771
+ final V1Pod pod = assertDoesNotThrow (() -> oracle .weblogic .kubernetes .assertions .impl .Kubernetes
772
+ .getPod (namespace , null , podName ));
773
+
774
+ if (pod != null ) {
775
+ ExecResult execResult = assertDoesNotThrow (
776
+ () -> execCommand (pod , null , true , READ_STATE_COMMAND ));
777
+ if (execResult .exitValue () == 0 ) {
778
+ logger .info ("execResult: " + execResult );
779
+ assertEquals ("RUNNING" , execResult .stdout (),
780
+ "Expected " + podName + ", in namespace " + namespace + ", to be in RUNNING ready status" );
781
+ } else {
782
+ fail ("Ready command failed with exit status code: " + execResult .exitValue ());
783
+ }
784
+ } else {
785
+ fail ("Did not find pod " + podName + " in namespace " + namespace );
786
+ }
787
+ }
788
+
760
789
}
0 commit comments