Skip to content

Commit

Permalink
Fix(inspect-code): Inverted method
Browse files Browse the repository at this point in the history
  • Loading branch information
rkubis committed Nov 22, 2024
1 parent 32c4b2f commit f980c87
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public boolean waitServiceAvailable() {

LOGGER.info("Waiting for API to be ready...");

while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
if (isServiceAvailable()) {
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static boolean waitApicurioRegistryHostnameReady(ApicurioRegistry apicuri

LOGGER.info("Waiting for hostname of ApicurioRegistry {} to be ready...", info);

while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
if (isApicurioRegistryHostnameReady(apicurioRegistry)) {
return true;
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public static boolean waitApicurioRegistryReady(ApicurioRegistry apicurioRegistr
ApicurioRegistryResourceType registryResourceType = new ApicurioRegistryResourceType();
TimeoutBudget timeoutBudget = TimeoutBudget.ofDuration(registryResourceType.getTimeout());

while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (registryResourceType.isReady(apicurioRegistry)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static boolean waitDeploymentReady(String namespace, String name) {
}

public static boolean waitDeploymentReady(String namespace, String name, TimeoutBudget timeoutBudget) {
while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (!Kubernetes.deploymentHasUnavailableReplicas(namespace, name)) {
return true;
}
Expand Down Expand Up @@ -100,7 +100,7 @@ public static boolean waitDeploymentHasUnavailableReplicas(
String name,
TimeoutBudget timeoutBudget
) {
while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (Kubernetes.deploymentHasUnavailableReplicas(namespace, name)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private static boolean waitSecretReady(String namespace, String name) {
}

private static boolean waitSecretReady(String namespace, String name, TimeoutBudget timeoutBudget) {
while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (Kubernetes.getSecret(namespace, name) != null) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static void downloadFile(String source, Path destination) throws Exceptio
}

public static boolean waitPodsExist(String namespace, String labelKey, String labelValue, TimeoutBudget timeout) {
while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
if (!Kubernetes.getPods(namespace, labelKey, labelValue).getItems().isEmpty()) {
return true;
}
Expand Down Expand Up @@ -112,7 +112,7 @@ private static boolean collectPodsReadiness(PodList podList) {
}

public static boolean waitPodsReady(String namespace, String labelKey, String labelValue, TimeoutBudget timeout) {
while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
if (collectPodsReadiness(Kubernetes.getPods(namespace, labelKey, labelValue))) {
return true;
}
Expand Down Expand Up @@ -143,7 +143,7 @@ public static boolean waitPodsReady(String namespace, String labelKey, String la
}

public static boolean waitCatalogSourceExists(String namespace, String name, TimeoutBudget timeout) {
while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
if (Kubernetes.getCatalogSource(namespace, name) != null) {
return true;
}
Expand Down Expand Up @@ -171,7 +171,7 @@ public static boolean waitCatalogSourceExists(String namespace, String name) {
}

public static boolean waitCatalogSourceReady(String namespace, String name, TimeoutBudget timeout) {
while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
if (Kubernetes.isCatalogSourceReady(namespace, name)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static boolean waitStatefulSetReady(String namespace, String name) {
}

public static boolean waitStatefulSetReady(String namespace, String name, TimeoutBudget timeoutBudget) {
while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (Kubernetes.isStatefulSetReady(namespace, name)) {
return true;
}
Expand Down Expand Up @@ -47,7 +47,7 @@ public static boolean waitPackageManifestExists(String catalog, String name) {
}

public static boolean waitPackageManifestExists(String catalog, String name, TimeoutBudget timeoutBudget) {
while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (Kubernetes.getPackageManifest(catalog, name) != null) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public boolean waitOperatorReady(OperatorType operatorType) {
}

public boolean waitOperatorReady(OperatorType operatorType, TimeoutBudget timeoutBudget) {
while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (operatorType.isReady()) {
return true;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ public boolean waitOperatorRemoved(OperatorType operatorType) {
}

public boolean waitOperatorRemoved(OperatorType operatorType, TimeoutBudget timeoutBudget) {
while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (operatorType.doesNotExist()) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void uninstall() {
public boolean waitReady() {
TimeoutBudget timeoutBudget = TimeoutBudget.ofDuration(Duration.ofMinutes(7));

while (!timeoutBudget.timeoutExpired()) {
while (timeoutBudget.timeoutNotExpired()) {
if (isReady()) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public boolean waitSubscriptionCurrentCSV(String catalog, TimeoutBudget timeout)
String subscriptionName = subscription.getMetadata().getName();
Subscription operatorSubscription = Kubernetes.getSubscription(subscriptionNamespace, subscriptionName);

while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
if (operatorSubscription.getStatus().getCurrentCSV().equals(expectedCSV)) {
return true;
}
Expand All @@ -60,7 +60,7 @@ public boolean waitSubscriptionCurrentCSV(String catalog) {
}

public boolean waitClusterServiceVersionReady(TimeoutBudget timeout) {
while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
if (Kubernetes.isClusterServiceVersionReady(getNamespace(), getClusterServiceVersion())) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public final <T extends HasMetadata> boolean waitResourceCondition(

T res;

while (!timeout.timeoutExpired()) {
while (timeout.timeoutNotExpired()) {
res = type.get(resource.getMetadata().getNamespace(), resource.getMetadata().getName());

if (condition.test(res)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public Duration remaining() {
return Duration.ofMillis(timeLeft());
}

public boolean timeoutExpired() {
return timeLeft() < 0;
public boolean timeoutNotExpired() {
return timeLeft() >= 0;
}

public long timeSpent() {
Expand Down

0 comments on commit f980c87

Please sign in to comment.