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

Add a long report ETL for testing pipeline job cancellation #2091

Merged
merged 7 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
15 changes: 15 additions & 0 deletions modules/ETLtest/resources/ETLs/rReportWithSleep.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<etl xmlns="http://labkey.org/etl/xml">
<name>Long Running Report ETL</name>
<description>run scheduled report</description>
<transforms>
<transform id="step1" type="TaskRefTransformStep">
<taskref ref="org.labkey.di.pipeline.RunReportTask">
<settings>
<setting name="reportId" value="module:ETLtest/etlReportWithSleep.R"/>
<setting name="greeter" value="STEP1"/>
</settings>
</taskref>
</transform>
</transforms>
</etl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cat('Hello, ', labkey.url.params$greeter, '!\n', sep='')
Sys.sleep(20)
cat('Goodbye, ', labkey.url.params$greeter, '!\n', sep='')
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ReportDescriptor descriptorType="rReportDescriptor" reportName="etlReportWithSleep" xmlns="http://labkey.org/query/xml">
<Properties>
<Prop name="runInBackground">true</Prop>
</Properties>
<tags/>
</ReportDescriptor>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.labkey.test.components.Component;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably we should wait for when we consolidate into premiumModules, but it seems like it would be nice to have this test code and the ETLtest module live into the same repo as dataintegration

import org.labkey.test.components.html.BootstrapMenu;
import org.labkey.test.pages.LabKeyPage;
import org.labkey.test.pages.pipeline.PipelineStatusDetailsPage;
import org.labkey.test.selenium.LazyWebElement;
import org.labkey.test.util.Ext4Helper;
import org.labkey.test.util.LogMethod;
Expand All @@ -31,33 +32,33 @@
import java.util.HashMap;
import java.util.Map;

public class ETLScheduler extends LabKeyPage<ETLScheduler.Elements>
public class ETLSchedulerPage extends LabKeyPage<ETLSchedulerPage.Elements>
{
public ETLScheduler(BaseWebDriverTest test)
public ETLSchedulerPage(BaseWebDriverTest test)
{
super(test);
}

public static ETLScheduler beginAt(BaseWebDriverTest test)
public static ETLSchedulerPage beginAt(BaseWebDriverTest test)
{
return beginAt(test, test.getCurrentContainerPath());
}

public static ETLScheduler beginAt(BaseWebDriverTest test, String containerPath)
public static ETLSchedulerPage beginAt(BaseWebDriverTest test, String containerPath)
{
test.beginAt(WebTestHelper.buildURL("dataintegration", containerPath, "begin"));
return new ETLScheduler(test);
return new ETLSchedulerPage(test);
}

public TransformRow transform(String transformId)
{
return elementCache().findTransformRow(transformId);
}

public LabKeyPage viewProcessedJobs()
public LabKeyPage<?> viewProcessedJobs()
{
_test.clickAndWait(elementCache().viewProcessedJobsButton);
return new LabKeyPage(_test);
clickAndWait(elementCache().viewProcessedJobsButton);
return new LabKeyPage<>(this);
}

public int rowCount()
Expand All @@ -71,9 +72,9 @@ protected Elements elementCache()
return new Elements();
}

protected class Elements extends LabKeyPage<?>.ElementCache
protected class Elements extends LabKeyPage<Elements>.ElementCache
{
private Map<String, TransformRow> transformRows = new HashMap<>();
private final Map<String, TransformRow> transformRows = new HashMap<>();

protected TransformRow findTransformRow(String transformId)
{
Expand Down Expand Up @@ -116,7 +117,7 @@ public boolean isEnabled()

public TransformRow setEnabled(boolean enable)
{
_test.setCheckbox(elementCache().enabledCheckbox, enable);
setCheckbox(elementCache().enabledCheckbox, enable);
return this;
}

Expand All @@ -127,7 +128,7 @@ public TransformRow setEnabled(boolean enable)
//
// public TransformRow setVerboseLoggingEnabled(boolean enable)
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete this commented out code?

// {
// _test.setCheckbox(elements().verboseLoggingCheckbox, enable);
// setCheckbox(elements().verboseLoggingCheckbox, enable);
// return this;
// }

Expand Down Expand Up @@ -159,44 +160,44 @@ public String getLastStatus()
return elementCache().lastStatus.getText();
}

public LabKeyPage clickLastStatus()
public PipelineStatusDetailsPage clickLastStatus()
{
_test.clickAndWait(elementCache().lastStatus.findElement(By.cssSelector("a")));
clickAndWait(elementCache().lastStatus.findElement(By.cssSelector("a")));

return new LabKeyPage(_test);
return new PipelineStatusDetailsPage(getDriver());
}

public String getLastRun()
{
return elementCache().lastRun.getText();
}

public LabKeyPage clickLastRun()
public PipelineStatusDetailsPage clickLastRun()
{
_test.clickAndWait(elementCache().lastRun.findElement(By.cssSelector("a")));
clickAndWait(elementCache().lastRun.findElement(By.cssSelector("a")));

return new LabKeyPage(_test);
return new PipelineStatusDetailsPage(getDriver());
}

public String getLastChecked()
{
return elementCache().lastChecked.getText();
}

public LabKeyPage runNow()
public PipelineStatusDetailsPage runNow()
{
_test.clickAndWait(elementCache().runNowButton);
clickAndWait(elementCache().runNowButton);

return new LabKeyPage(_test);
return new PipelineStatusDetailsPage(getDriver());
}

public LabKeyPage reset()
public ETLSchedulerPage reset()
{
new BootstrapMenu(getDriver(), Locator.tagWithClassContaining("div", "lk-menu-drop")
.withChild(Locator.lkButton("Reset State...")).findElement(this))
.clickSubMenu(true, "Reset");

return new LabKeyPage(_test);
return ETLSchedulerPage.this;
}

@LogMethod(quiet = true)
Expand All @@ -219,35 +220,35 @@ public class Confirm
{
public Confirm()
{
_test.waitForElement(Ext4Helper.Locators.window("Confirm"));
waitForElement(Ext4Helper.Locators.window("Confirm"));
}

public Confirm assertMessageContains()
{
throw new NotImplementedException("");
}

public ETLScheduler confirmNo()
public ETLSchedulerPage confirmNo()
{
Locator.XPathLocator noButton = Ext4Helper.Locators.windowButton("Confirm", "No");
_test.click(noButton);
_test.waitForElementToDisappear(noButton);
click(noButton);
waitForElementToDisappear(noButton);

return ETLScheduler.this;
return ETLSchedulerPage.this;
}

public ETLScheduler confirmYes()
public ETLSchedulerPage confirmYes()
{
_test.click(Ext4Helper.Locators.windowButton("Confirm", "Yes"));
_test.waitForElement(Ext4Helper.Locators.window("Success"));
_test.click(Ext4Helper.Locators.windowButton("Success", "OK"));
_test.waitForElementToDisappear(Ext4Helper.Locators.window("Success"));
click(Ext4Helper.Locators.windowButton("Confirm", "Yes"));
waitForElement(Ext4Helper.Locators.window("Success"));
click(Ext4Helper.Locators.windowButton("Success", "OK"));
waitForElementToDisappear(Ext4Helper.Locators.window("Success"));

return ETLScheduler.this;
return ETLSchedulerPage.this;
}
}

private class RowElements extends Component<?>.ElementCache
protected class RowElements extends Component<RowElements>.ElementCache
{
// Column numbers
private final int NAME = 1;
Expand Down