diff --git a/src/org/labkey/test/tests/assay/AssayTransformImportUpdateTest.java b/src/org/labkey/test/tests/assay/AssayTransformImportUpdateTest.java index 91272d4508..f05392870b 100644 --- a/src/org/labkey/test/tests/assay/AssayTransformImportUpdateTest.java +++ b/src/org/labkey/test/tests/assay/AssayTransformImportUpdateTest.java @@ -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; @@ -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 = """ @@ -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")); @@ -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(); }