Skip to content

Commit

Permalink
fix Sonar issues
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Edgar <[email protected]>
  • Loading branch information
MikeEdgar committed Dec 19, 2024
1 parent 3ecc0fd commit 8e8da27
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void testConsoleReconciliationWithMissingRules() {
assertInvalidConfiguration(consoleCR, errorConditions -> {
assertEquals(1, errorConditions.size());
var errorCondition = errorConditions.get(0);
Supplier<String> errorString = () -> errorCondition.toString();
Supplier<String> errorString = errorCondition::toString;

assertEquals(Condition.Types.ERROR, errorCondition.getType(), errorString);
assertEquals("True", errorCondition.getStatus(), errorString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ void testConsoleReconciliationWithValidKafkaUser() {
.get();
assertEquals(1, console.getStatus().getConditions().size());
var ready = console.getStatus().getConditions().iterator().next();
assertEquals(Condition.Types.READY, ready.getType(), () -> ready.toString());
assertEquals("False", ready.getStatus());
assertEquals("DependentsNotReady", ready.getReason());
assertEquals(Condition.Types.READY, ready.getType(), ready::toString);
assertEquals("False", ready.getStatus(), ready::toString);
assertEquals("DependentsNotReady", ready.getReason(), ready::toString);

var consoleSecret = client.secrets().inNamespace("ns2").withName("console-1-" + ConsoleSecret.NAME).get();
assertNotNull(consoleSecret);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static <T extends HasMetadata> T apply(KubernetesClient client, T resourc
}

@BeforeEach
void setUp() throws Exception {
void setUp() {
client.resource(Crds.kafka()).serverSideApply();
client.resource(Crds.kafkaUser()).serverSideApply();
client.resource(new CustomResourceDefinitionBuilder()
Expand Down Expand Up @@ -206,10 +206,10 @@ void awaitReady(Console resource) {
assertEquals(1, console.getStatus().getConditions().size());
var condition = console.getStatus().getConditions().iterator().next();

assertEquals(Condition.Types.READY, condition.getType());
assertEquals("True", condition.getStatus());
assertEquals(Condition.Types.READY, condition.getType(), condition::toString);
assertEquals("True", condition.getStatus(), condition::toString);
assertNull(condition.getReason());
assertEquals("All resources ready", condition.getMessage());
assertEquals("All resources ready", condition.getMessage(), condition::toString);
});
}

Expand All @@ -223,9 +223,9 @@ void awaitDependentsNotReady(Console resource, String... dependents) {
assertEquals(1, console.getStatus().getConditions().size());
var condition = console.getStatus().getConditions().iterator().next();

assertEquals(Condition.Types.READY, condition.getType(), () -> condition.toString());
assertEquals("False", condition.getStatus());
assertEquals(Condition.Reasons.DEPENDENTS_NOT_READY, condition.getReason());
assertEquals(Condition.Types.READY, condition.getType(), condition::toString);
assertEquals("False", condition.getStatus(), condition::toString);
assertEquals(Condition.Reasons.DEPENDENTS_NOT_READY, condition.getReason(), condition::toString);

for (String dependent : dependents) {
assertTrue(condition.getMessage().contains(dependent));
Expand All @@ -244,9 +244,9 @@ void assertInvalidConfiguration(Console resource, Consumer<List<Condition>> asse
assertTrue(conditions.size() > 1);

var readyCondition = conditions.iterator().next();
assertEquals(Condition.Types.READY, readyCondition.getType(), () -> readyCondition.toString());
assertEquals("False", readyCondition.getStatus());
assertEquals(Condition.Reasons.INVALID_CONFIGURATION, readyCondition.getReason());
assertEquals(Condition.Types.READY, readyCondition.getType(), readyCondition::toString);
assertEquals("False", readyCondition.getStatus(), readyCondition::toString);
assertEquals(Condition.Reasons.INVALID_CONFIGURATION, readyCondition.getReason(), readyCondition::toString);

// Ready is always sorted as the first condition for ease of reference
List<Condition> errors = List.copyOf(conditions).subList(1, conditions.size());
Expand Down

0 comments on commit 8e8da27

Please sign in to comment.