Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
package org.labkey.test.tests.assay;

import org.assertj.core.api.Assertions;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.labkey.test.BaseWebDriverTest;
import org.labkey.test.Locator;
import org.labkey.test.TestFileUtils;
import org.labkey.test.WebTestHelper;
import org.labkey.test.categories.Assays;
import org.labkey.test.categories.Daily;
import org.labkey.test.pages.ReactAssayDesignerPage;
import org.labkey.test.pages.admin.UsageStatisticsPage;
import org.labkey.test.pages.assay.AssayImportPage;
import org.labkey.test.pages.assay.AssayRunsPage;
import org.labkey.test.pages.core.admin.ShowAdminPage;
import org.labkey.test.pages.pipeline.PipelineStatusDetailsPage;
import org.labkey.test.params.FieldDefinition;
import org.labkey.test.params.assay.GeneralAssayDesign;
import org.labkey.test.util.PipelineStatusTable;
import org.labkey.test.util.RReportHelper;

import java.io.File;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -224,6 +230,9 @@ public void testEnableTransformForUpdate() throws Exception
@Test
public void testCancelAsyncAssayTransformJob() throws Exception
{
Assume.assumeTrue("Issue 53240: User cannot cancel pipeline job on SQL",
WebTestHelper.getDatabaseType() != WebTestHelper.DatabaseType.MicrosoftSQLServer);

String transformCancelFile = "importCancelTransform.R";
String importCancelTransformAssay = "importCancelTransformAssay";
String transformContent = """
Expand Down Expand Up @@ -274,6 +283,7 @@ public void testCancelAsyncAssayTransformJob() throws Exception
var importPage = new AssayImportPage(getDriver());
importPage.setNamedInputText("name", "cancelTransformTestImport");
importPage.setNamedTextAreaValue("TextAreaDataCollector.textArea", importDataBuilder.toString());
Instant before = Instant.now();
importPage.clickSaveAndFinish();

waitAndClickAndWait(Locator.linkWithText("Assay upload RUNNING"));
Expand All @@ -285,6 +295,20 @@ public void testCancelAsyncAssayTransformJob() throws Exception
"INFO : Interrupting job by sending interrupt request.",
"ERROR: The following error was generated by the assay upload",
"INFO : Failed to complete task 'org.labkey.api.assay.pipeline.AssayUploadPipelineTask'");
Instant after = Instant.now();
Duration duration = Duration.between(before, after);
log(String.format("duration of pipeline run from start to cancel is %d seconds", duration.getSeconds()));
checker().withScreenshot("unexpected duration")
.wrapAssertion(()-> Assertions.assertThat(duration.getSeconds())
.as("expect cancel to interrupt the sleep in the transform script")
.isLessThan(20));

// verify in the server log the process termination logging
ShowAdminPage adminPage = goToAdminConsole();
adminPage.clickViewPrimarySiteLogFile();
assertTextPresent("Attempting to kill forked process gracefully",
"Finished dealing with forked process");

resetErrors();
}

Expand Down