Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/org/labkey/test/tests/BasicTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions src/org/labkey/test/tests/DatabaseDiagnosticsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.labkey.test.io.Grep;
import org.labkey.test.pages.core.admin.SiteValidationPage;
import org.labkey.test.pages.pipeline.PipelineStatusDetailsPage;
import org.labkey.test.util.AttachmentHelper;
import org.labkey.test.util.Maps;
import org.labkey.test.util.Order;
import org.labkey.test.util.PasswordUtil;
Expand Down Expand Up @@ -135,6 +136,14 @@ public void collectActionExceptions()
getArtifactCollector().dumpPageSnapshot("exceptions", null);
}

@Test
public void testOrphanedAttachments()
{
int orphanCount = AttachmentHelper.logOrphanedAttachments();
if (orphanCount > 0)
log("Orphaned attachments: " + orphanCount);
}

@Override
public List<String> getAssociatedModules()
{
Expand Down
29 changes: 29 additions & 0 deletions src/org/labkey/test/util/AttachmentHelper.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
1 change: 0 additions & 1 deletion src/org/labkey/test/util/Crawler.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ protected List<ControllerActionId> 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
Expand Down
Loading