Commit 19d07aaf authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Updating unit tests based on latest javadoc fixes

parent 49744f3d
Loading
Loading
Loading
Loading
Loading
+18 −17
Original line number Diff line number Diff line
@@ -94,9 +94,8 @@ public class KubernetesCRV1ApplyStateTest {

  /**
   * A verdict is authoritative: individual operational/administrative values reported alongside
   * it do not override the pair it implies. (This pins the precedence the implementation and its
   * Javadoc agree on; the field-level comment on {@code healthValue} currently claims the
   * opposite.)
   * it do not override the pair it implies — they are consulted only when no
   * {@code healthValue} was given.
   */
  @Test
  public void healthValueWinsOverIndividualOperAndAdminValues() {
@@ -109,20 +108,22 @@ public class KubernetesCRV1ApplyStateTest {
    assertState(rs, ResourceOperationalStateType.ENABLE, ResourceAdministrativeStateType.UNLOCKED);
  }

  // /**
  //  * Usage state is orthogonal to health — {@link ResourceHealth} deliberately does not consult it —
  //  * so a reported {@code usageStateValue} must survive a {@code healthValue} being present.
  //  */
  // @Test
  // public void usageStateIsAppliedEvenWhenAVerdictWasGiven() {
  //   ResourceCreate rs = aCR()
  //       .healthValue(ResourceHealth.UP)
  //       .usageStateValue(ResourceUsageStateType.BUSY)
  //       .build().toResourceCreate();

  //   assertState(rs, ResourceOperationalStateType.ENABLE, ResourceAdministrativeStateType.UNLOCKED);
  //   assertEquals(ResourceUsageStateType.BUSY, rs.getUsageState());
  // }
  /**
   * The same precedence covers {@code usageStateValue}: once a verdict is given the individual
   * attributes are ignored wholesale, so usage state is left unset alongside them. A producer that
   * wants to report usage state must report the operational/administrative attributes individually
   * instead of a {@code healthValue}.
   */
  @Test
  public void usageStateIsIgnoredWhenAVerdictWasGiven() {
    ResourceCreate rs = aCR()
        .healthValue(ResourceHealth.UP)
        .usageStateValue(ResourceUsageStateType.BUSY)
        .build().toResourceCreate();

    assertState(rs, ResourceOperationalStateType.ENABLE, ResourceAdministrativeStateType.UNLOCKED);
    assertNull(rs.getUsageState(), "usageState");
  }

  /**
   * The watcher stamps {@link KubernetesCRV1#OSL_LABEL_DELETED} on a CR it saw disappear from the