PodDisruptionBudgetDiff extends AbstractResourceDiff { @Override public boolean isEmpty() { return isEmpty; } PodDisruptionBudgetDiff(PodDisruptionBudget current, PodDisruptionBudget desired); @Override boolean isEmpty();  }
@Test public void testNoDiff() { PodDisruptionBudget pdb1 = new PodDisruptionBudgetBuilder() .withNewMetadata() .withName("my-pdb") .withNamespace("my-ns") .withLabels(singletonMap("foo", "bar")) .endMetadata() .withNewSpec() .withNewMaxUnavailable(1) .endSpec() .build(); PodDisruptionBudget pdb2 = new PodDisruptionBudgetBuilder() .withNewMetadata() .withName("my-pdb") .withNamespace("my-ns") .withLabels(singletonMap("foo", "bar")) .endMetadata() .withNewSpec() .withNewMaxUnavailable(1) .endSpec() .build(); assertThat((new PodDisruptionBudgetDiff(pdb1, pdb2)).isEmpty(), is(true)); }
@Test public void testMaxUnavailableDiff() { PodDisruptionBudget pdb1 = new PodDisruptionBudgetBuilder() .withNewMetadata() .withName("my-pdb") .withNamespace("my-ns") .withLabels(singletonMap("foo", "bar")) .endMetadata() .withNewSpec() .withNewMaxUnavailable(1) .endSpec() .build(); PodDisruptionBudget pdb2 = new PodDisruptionBudgetBuilder() .withNewMetadata() .withName("my-pdb") .withNamespace("my-ns") .withLabels(singletonMap("foo", "bar")) .endMetadata() .withNewSpec() .withNewMaxUnavailable(2) .endSpec() .build(); assertThat((new PodDisruptionBudgetDiff(pdb1, pdb2)).isEmpty(), is(false)); }
@Test public void testMetadataDiff() { PodDisruptionBudget pdb1 = new PodDisruptionBudgetBuilder() .withNewMetadata() .withName("my-pdb") .withNamespace("my-ns") .withLabels(singletonMap("foo", "bar")) .endMetadata() .withNewSpec() .withNewMaxUnavailable(1) .endSpec() .build(); PodDisruptionBudget pdb2 = new PodDisruptionBudgetBuilder() .withNewMetadata() .withName("my-pdb") .withNamespace("my-ns") .withLabels(singletonMap("foo", "bar2")) .endMetadata() .withNewSpec() .withNewMaxUnavailable(1) .endSpec() .build(); assertThat((new PodDisruptionBudgetDiff(pdb1, pdb2)).isEmpty(), is(false)); }