Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded calls from pods stability #63

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/main/java/io/odh/test/utils/PodUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,17 @@ public static void verifyThatPodsAreStable(String namespaceName, LabelSelector l

TestUtils.waitFor(String.format("Pods in namespace '%s' with LabelSelector %s stability in phase %s", namespaceName, labelSelector, phase), TestConstants.GLOBAL_POLL_INTERVAL_SHORT, TestConstants.GLOBAL_TIMEOUT,
() -> {
List<Pod> runningPods = ResourceManager.getClient().listPods(namespaceName, labelSelector);
List<Pod> actualPods = runningPods.stream().map(p -> ResourceManager.getClient().getPod(namespaceName, p.getMetadata().getName())).toList();
LOGGER.debug("Working with the following pods: {}", actualPods.stream().map(p -> p.getMetadata().getName()).toList());
List<Pod> existingPod = ResourceManager.getClient().listPods(namespaceName, labelSelector);
LOGGER.debug("Working with the following pods: {}", existingPod.stream().map(p -> p.getMetadata().getName()).toList());

for (Pod pod : actualPods) {
for (Pod pod : existingPod) {
if (pod == null) {
continue;
}
if (pod.getStatus().getPhase().equals(phase)) {
LOGGER.debug("Pod: {}/{} is in the {} state. Remaining seconds for Pod to be stable {}",
namespaceName, pod.getMetadata().getName(), pod.getStatus().getPhase(),
TestConstants.GLOBAL_STABILITY_TIME / (TestConstants.GLOBAL_POLL_INTERVAL_SHORT / 1000) - stabilityCounter[0]);
TestConstants.GLOBAL_STABILITY_TIME - (TestConstants.GLOBAL_POLL_INTERVAL_SHORT / 1000 * stabilityCounter[0]));
} else {
LOGGER.warn("Pod: {}/{} is not stable in phase following phase {} ({}) reset the stability counter from {}s to {}s",
namespaceName, pod.getMetadata().getName(), pod.getStatus().getPhase(), phase, stabilityCounter[0], 0);
Expand All @@ -133,7 +132,7 @@ public static void verifyThatPodsAreStable(String namespaceName, LabelSelector l
stabilityCounter[0]++;

if (stabilityCounter[0] == TestConstants.GLOBAL_STABILITY_TIME / (TestConstants.GLOBAL_POLL_INTERVAL_SHORT / 1000)) {
LOGGER.info("All Pods are stable {}", actualPods.stream().map(p -> p.getMetadata().getName()).collect(Collectors.joining(" ,")));
LOGGER.info("All Pods are stable {}", existingPod.stream().map(p -> p.getMetadata().getName()).collect(Collectors.joining(" ,")));
return true;
}
return false;
Expand Down
Loading