Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -857,13 +857,23 @@ private Collection<DomainPresenceInfo.ServerStartupInfo> getServerStartupInfos()

// when the domain start policy is ADMIN_ONLY, the admin server is considered to be an application server.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is bit misleading after the change.

private boolean isApplicationServer(String serverName) {
return isAdminOnlyDomain() || !isAdminServer(serverName);
return !isAdminServer(serverName);
}

private boolean isAdminOnlyDomain() {
return isAdminOnlyServerStartPolicy()
|| isOnlyAdminServerRunningInDomain();
}

private boolean isAdminOnlyServerStartPolicy() {
return getDomain().getSpec().getServerStartPolicy() == ServerStartPolicy.ADMIN_ONLY;
}

private boolean isOnlyAdminServerRunningInDomain() {
return status.getServers().size() == 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this doesn't take into account the servers or clusters that have been intentioanlly shut down.

&& status.getServers().get(0).getServerName().equals(getInfo().getAdminServerName());
}

private boolean isAdminServer(String serverName) {
return status.getServers().stream()
.filter(s -> s.getServerName().equals(serverName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,16 @@ void whenServerStartupInfoIsNull_availableIsFalse() {
hasItems(new ClusterCondition(ClusterConditionType.AVAILABLE).withStatus(FALSE)));
}

@Test
void whenDomainOnlyHasAdminServer_availableIsTrue() {
configureDomain().configureAdminServer();
defineScenario().build();

updateDomainStatus();

assertThat(getRecordedDomain(), hasCondition(AVAILABLE).withStatus(TRUE));
}

private Collection<ClusterCondition> getClusterConditions() {
return testSupport.<ClusterResource>getResourceWithName(KubernetesTestSupport.CLUSTER, "cluster1")
.getStatus().getConditions();
Expand Down