diff --git a/src/org/labkey/test/tests/BasicTest.java b/src/org/labkey/test/tests/BasicTest.java index 0c9f1a1dcb..fb5c2adea4 100644 --- a/src/org/labkey/test/tests/BasicTest.java +++ b/src/org/labkey/test/tests/BasicTest.java @@ -29,6 +29,7 @@ import org.labkey.test.categories.Hosting; import org.labkey.test.categories.Smoke; import org.labkey.test.pages.core.admin.ShowAdminPage; +import org.labkey.test.util.AttachmentHelper; import org.labkey.test.util.Order; import java.util.List; @@ -62,6 +63,14 @@ public void testScripts() assertTextNotPresent("WARNING:"); } + @Test + public void testOrphanedAttachments() + { + int orphanCount = AttachmentHelper.logOrphanedAttachments(); + if (orphanCount > 0) + log("Orphaned attachments: " + orphanCount); + } + @Test public void testStartupLogging() { diff --git a/src/org/labkey/test/util/AttachmentHelper.java b/src/org/labkey/test/util/AttachmentHelper.java new file mode 100644 index 0000000000..8f1823eaa9 --- /dev/null +++ b/src/org/labkey/test/util/AttachmentHelper.java @@ -0,0 +1,29 @@ +package org.labkey.test.util; + +import org.labkey.remoteapi.CommandException; +import org.labkey.remoteapi.CommandResponse; +import org.labkey.remoteapi.SimpleGetCommand; +import org.labkey.test.WebTestHelper; + +import java.io.IOException; + +public class AttachmentHelper +{ + /** + * Tells LabKey to log the first 20 orphaned attachments it detects at the ERROR level. Returns the total number of + * orphaned attachments detected. Must be a root admin (site or app) to call this. + */ + public static int logOrphanedAttachments() + { + SimpleGetCommand command = new SimpleGetCommand("admin", "logOrphanedAttachments"); + try + { + CommandResponse response = command.execute(WebTestHelper.getRemoteApiConnection(), "/"); + return response.getProperty("count"); + } + catch (IOException | CommandException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/src/org/labkey/test/util/Crawler.java b/src/org/labkey/test/util/Crawler.java index c040dc5fca..9b7d6b8884 100644 --- a/src/org/labkey/test/util/Crawler.java +++ b/src/org/labkey/test/util/Crawler.java @@ -194,7 +194,6 @@ protected List getDefaultExcludedActions() new ControllerActionId("login", "setPassword"), new ControllerActionId("ms2", "showList"), new ControllerActionId("ms2", "showParamsFile"), - new ControllerActionId("nlp", "runPipeline"), new ControllerActionId("pipeline-analysis", "analyze"), // Doesn't navigate new ControllerActionId("project", "togglePageAdminMode"), // Tested directly in XTandemTest