@@ -332,8 +332,7 @@ void whenStatusUnchanged_statusStepDoesNotUpdateDomain() {
332332 .withStateGoal (SHUTDOWN_STATE )
333333 .withServerName ("server1" )
334334 .withHealth (overallHealth ("health1" ))))
335- .addCondition (new DomainCondition (AVAILABLE ).withStatus (false )
336- .withMessage (LOGGER .formatMessage (NO_APPLICATION_SERVERS_READY )))
335+ .addCondition (new DomainCondition (AVAILABLE ).withStatus (true ))
337336 .addCondition (new DomainCondition (COMPLETED ).withStatus (true )));
338337
339338 testSupport .clearNumCalls ();
@@ -1041,15 +1040,15 @@ void whenNumServersStartedBelowMinReplicasForDynamicClusterAndAllowed_domainIsAv
10411040 }
10421041
10431042 @ Test
1044- void whenReplicaCountIsZero_domainIsNotAvailable () {
1043+ void whenReplicaCountIsZeroAndAdminServerRunning_domainIsAvailable () {
10451044 defineScenario ()
10461045 .withDynamicCluster ("cluster1" , 3 , 4 )
10471046 .notStarting ("ms1" , "ms2" , "ms3" , "ms4" )
10481047 .build ();
10491048
10501049 updateDomainStatus ();
10511050
1052- assertThat (getRecordedDomain (), hasCondition (AVAILABLE ).withStatus (FALSE ));
1051+ assertThat (getRecordedDomain (), hasCondition (AVAILABLE ).withStatus (TRUE ));
10531052 }
10541053
10551054 @ Test
@@ -1108,7 +1107,7 @@ void whenReplicaCountNotWithinMaxUnavailableOfReplicas_establishClusterAvailable
11081107 }
11091108
11101109 @ Test
1111- void whenClusterIsIntentionallyShutdown_establishClusterAvailableConditionTrue () {
1110+ void whenClusterIsIntentionallyShutdown_establishClusterAvailableConditionFalse () {
11121111 configureDomain ().configureCluster (info , "cluster1" ).withReplicas (0 ).withMaxUnavailable (1 );
11131112 defineScenario ().withDynamicCluster ("cluster1" , 0 , 0 ).build ();
11141113 info .getReferencedClusters ().forEach (testSupport ::defineResources );
@@ -1119,7 +1118,7 @@ void whenClusterIsIntentionallyShutdown_establishClusterAvailableConditionTrue()
11191118 assertThat (clusterStatus .getConditions ().size (), equalTo (2 ));
11201119 ClusterCondition condition = clusterStatus .getConditions ().get (0 );
11211120 assertThat (condition .getType (), equalTo (ClusterConditionType .AVAILABLE ));
1122- assertThat (condition .getStatus (), equalTo (TRUE ));
1121+ assertThat (condition .getStatus (), equalTo (FALSE ));
11231122 }
11241123
11251124 @ Test
@@ -1267,15 +1266,15 @@ void withAllServersShutdown_domainIsCompleted() { // !!!! can the admin server
12671266 }
12681267
12691268 @ Test
1270- void withClusterIntentionallyShutdown_domainIsCompleted () {
1269+ void withClusterIntentionallyShutdownAndAdminServerRunning_domainIsAvailableAndCompleted () {
12711270 defineScenario ()
12721271 .withCluster ("cluster1" , "ms1" , "ms2" )
12731272 .notStarting ("ms1" , "ms2" )
12741273 .build ();
12751274
12761275 updateDomainStatus ();
12771276
1278- assertThat (getRecordedDomain (), hasCondition (AVAILABLE ).withStatus (FALSE ));
1277+ assertThat (getRecordedDomain (), hasCondition (AVAILABLE ).withStatus (TRUE ));
12791278 assertThat (getRecordedDomain (), hasCondition (COMPLETED ).withStatus (TRUE ));
12801279 }
12811280
@@ -1621,6 +1620,16 @@ void whenAdminOnlyAndAdminServerIsReady_availableIsTrue() {
16211620 assertThat (getRecordedDomain (), hasCondition (AVAILABLE ).withStatus (TRUE ));
16221621 }
16231622
1623+ @ Test
1624+ void whenDomainHasNeverStartPolicy_completedIsTrue () {
1625+ configureDomain ().withDefaultServerStartPolicy (ServerStartPolicy .NEVER );
1626+ defineScenario ().build ();
1627+
1628+ updateDomainStatus ();
1629+
1630+ assertThat (getRecordedDomain (), hasCondition (COMPLETED ).withStatus (TRUE ));
1631+ }
1632+
16241633 @ Test
16251634 void whenAdminOnlyAndAdminServerIsNotReady_availableIsFalse () {
16261635 configureDomain ().withDefaultServerStartPolicy (ServerStartPolicy .ADMIN_ONLY );
@@ -1736,11 +1745,56 @@ void whenServerStartupInfoIsNull_availableIsFalse() {
17361745 hasItems (new ClusterCondition (ClusterConditionType .AVAILABLE ).withStatus (FALSE )));
17371746 }
17381747
1748+ @ Test
1749+ void whenDomainOnlyHasAdminServer_availableIsTrue () {
1750+ configureDomain ().configureAdminServer ();
1751+ defineScenario ().build ();
1752+
1753+ updateDomainStatus ();
1754+
1755+ assertThat (getRecordedDomain (), hasCondition (AVAILABLE ).withStatus (TRUE ));
1756+ }
1757+
17391758 private Collection <ClusterCondition > getClusterConditions () {
17401759 return testSupport .<ClusterResource >getResourceWithName (KubernetesTestSupport .CLUSTER , "cluster1" )
17411760 .getStatus ().getConditions ();
17421761 }
17431762
1763+ @ Test
1764+ void whenClusterIntentionallyShutdown_clusterAvailableIsFalseAndDomainAvailableIsTrue () {
1765+ configureDomain ()
1766+ .configureCluster (info , "cluster1" ).withReplicas (0 );
1767+ info .getReferencedClusters ().forEach (testSupport ::defineResources );
1768+ defineScenario ()
1769+ .withCluster ("cluster1" , "server1" , "server2" )
1770+ .notStarting ("server1" , "server2" )
1771+ .build ();
1772+
1773+ updateDomainStatus ();
1774+
1775+ assertThat (getClusterConditions (),
1776+ hasItems (new ClusterCondition (ClusterConditionType .AVAILABLE ).withStatus (FALSE )));
1777+ assertThat (getRecordedDomain (), hasCondition (AVAILABLE ).withStatus (TRUE ));
1778+ }
1779+
1780+ @ Test
1781+ void whenClusterIntentionallyShutdownAndSSINotConstructed_clusterAndDomainAvailableIsFalse () {
1782+ configureDomain ()
1783+ .configureCluster (info , "cluster1" ).withReplicas (0 );
1784+ info .getReferencedClusters ().forEach (testSupport ::defineResources );
1785+ defineScenario ()
1786+ .withCluster ("cluster1" , "server1" , "server2" )
1787+ .notStarting ("server1" , "server2" )
1788+ .build ();
1789+ info .setServerStartupInfo (null );
1790+
1791+ updateDomainStatus ();
1792+
1793+ assertThat (getClusterConditions (),
1794+ hasItems (new ClusterCondition (ClusterConditionType .AVAILABLE ).withStatus (FALSE )));
1795+ assertThat (getRecordedDomain (), hasCondition (AVAILABLE ).withStatus (FALSE ));
1796+ }
1797+
17441798 @ SuppressWarnings ("SameParameterValue" )
17451799 private ScenarioBuilder defineScenario () {
17461800 return new ScenarioBuilder ();
0 commit comments