Skip to content

Commit 18c8c38

Browse files
committed
set server state to UNKNOWN if ReadHealthStep fails to obtain server state from WebLogic
1 parent 8468f80 commit 18c8c38

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

operator/src/main/java/oracle/kubernetes/operator/steps/ReadHealthStep.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.concurrent.atomic.AtomicInteger;
2121
import oracle.kubernetes.operator.Pair;
2222
import oracle.kubernetes.operator.ProcessingConstants;
23+
import oracle.kubernetes.operator.WebLogicConstants;
2324
import oracle.kubernetes.operator.helpers.DomainPresenceInfo;
2425
import oracle.kubernetes.operator.http.HttpClient;
2526
import oracle.kubernetes.operator.http.Result;
@@ -192,7 +193,7 @@ private Pair<String, ServerHealth> createServerHealthFromResult(Result restResul
192193
return parseServerHealthJson(restResult.getResponse());
193194
}
194195
return new Pair<>(
195-
"",
196+
WebLogicConstants.UNKNOWN_STATE,
196197
new ServerHealth()
197198
.withOverallHealth(
198199
restResult.isServerOverloaded()

operator/src/test/java/oracle/kubernetes/operator/steps/ReadHealthStepTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import static oracle.kubernetes.operator.logging.MessageKeys.WLS_HEALTH_READ_FAILED_NO_HTTPCLIENT;
1111
import static org.hamcrest.MatcherAssert.assertThat;
1212
import static org.hamcrest.Matchers.is;
13-
import static org.hamcrest.Matchers.nullValue;
1413

1514
import com.meterware.simplestub.Memento;
1615
import com.meterware.simplestub.Stub;
@@ -189,7 +188,7 @@ public void withHttpClientStep_verifyServerHealthForServerOverloadedAddedToPacke
189188
assertThat(
190189
serverHealth.getOverallHealth(), is(ReadHealthStep.OVERALL_HEALTH_FOR_SERVER_OVERLOADED));
191190
Map<String, String> serverStateMap = packet.getValue(SERVER_STATE_MAP);
192-
assertThat(serverStateMap.get(MANAGED_SERVER1), nullValue());
191+
assertThat(serverStateMap.get(MANAGED_SERVER1), is("UNKNOWN"));
193192
}
194193

195194
@Test
@@ -205,7 +204,7 @@ public void withHttpClientStep_verifyServerHealthForOtherErrorAddedToPacket() {
205204
ServerHealth serverHealth = serverHealthMap.get(MANAGED_SERVER1);
206205
assertThat(serverHealth.getOverallHealth(), is(ReadHealthStep.OVERALL_HEALTH_NOT_AVAILABLE));
207206
Map<String, String> serverStateMap = packet.getValue(SERVER_STATE_MAP);
208-
assertThat(serverStateMap.get(MANAGED_SERVER1), nullValue());
207+
assertThat(serverStateMap.get(MANAGED_SERVER1), is("UNKNOWN"));
209208
}
210209

211210
static final String OK_RESPONSE =

0 commit comments

Comments
 (0)