Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
35 changes: 29 additions & 6 deletions src/main/java/io/cdap/e2e/pages/actions/CdfPipelineRunAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,38 @@ public static void waitForPipelineToTransitionToStatus(String pipelineStatus, lo
* Timeout: {@link ConstantsUtil#IMPLICIT_TIMEOUT_SECONDS}
*/
public static void waitTillPipelineRunCompletes() throws InterruptedException {
// Adding a page refresh in case tests are running on CDF to update the pipeline status.
RetryUtils.retry(ConstantsUtil.PIPELINE_REFRESH_TIMEOUT_SECONDS, ConstantsUtil.PIPELINE_RUN_TIMEOUT_SECONDS,
10, () -> {
try {
// Wait for the Pipeline run to complete for the default timeout
WaitHelper.waitForElementToBeHidden(CdfPipelineRunLocators.runningStatus);
} catch (Exception e) {
e.printStackTrace();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we properly log the error?

}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove empty line


// Loop to refresh the page if the pipeline is still running till max refresh count
int maxRefreshCount = ConstantsUtil.MAX_PAGE_REFRESH_ATTEMPTS;
while (maxRefreshCount > 0) {
boolean isPipelineRunning = isRunning();

if (isPipelineRunning) {
PageHelper.refreshCurrentPage();
return !(isRunning());

try {
Thread.sleep(5000); // Wait for 5 second after the refresh
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to use the static wait as there are multiple threads running in parallel and UI responsiveness can introduce unwanted failures

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this to constant class?

} catch (InterruptedException e) {
e.printStackTrace();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment here

}
);

waitTillPipelineRunCompletes(ConstantsUtil.IMPLICIT_TIMEOUT_SECONDS);
WaitHelper.waitForPageToLoad();
WaitHelper.waitForElementToBeClickable(CdfPipelineRunLocators.runDropdownButton);
WaitHelper.waitForElementToBeHidden(
CdfPipelineRunLocators.runningStatus, ConstantsUtil.IMPLICIT_TIMEOUT_SECONDS);
} else {
break;
}

--maxRefreshCount;
}
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/cdap/e2e/utils/ConstantsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ public class ConstantsUtil {
public static final int PIPELINE_RUN_TIMEOUT_SECONDS = 900;

public static final int PIPELINE_REFRESH_TIMEOUT_SECONDS = 120;

public static final int MAX_PAGE_REFRESH_ATTEMPTS = 10;
}
Loading