Skip to content

Commit 420aae6

Browse files
Add test coverage for CycleCheckAction and CheckEdgesAction (#3021)
#### Rationale These actions in `ExperimentController` were completely untested and completely broken. #### Related Pull Requests - LabKey/platform#7697 #### Changes - Hit the happy path for these actions in SampleTypeLineageTest. Platform PR adds coverage for some unhappy paths.
1 parent d2fa3de commit 420aae6

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

src/org/labkey/test/tests/SampleTypeLineageTest.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.junit.Test;
2020
import org.junit.experimental.categories.Category;
2121
import org.labkey.remoteapi.CommandException;
22+
import org.labkey.remoteapi.SimpleGetCommand;
2223
import org.labkey.remoteapi.experiment.LineageCommand;
2324
import org.labkey.remoteapi.experiment.LineageNode;
2425
import org.labkey.remoteapi.experiment.LineageResponse;
@@ -29,6 +30,7 @@
2930
import org.labkey.test.Locator;
3031
import org.labkey.test.TestFileUtils;
3132
import org.labkey.test.TestTimeoutException;
33+
import org.labkey.test.WebTestHelper;
3234
import org.labkey.test.categories.Daily;
3335
import org.labkey.test.components.ext4.Window;
3436
import org.labkey.test.params.FieldDefinition;
@@ -70,7 +72,7 @@ public class SampleTypeLineageTest extends BaseWebDriverTest
7072
@Override
7173
public List<String> getAssociatedModules()
7274
{
73-
return Arrays.asList("experiment");
75+
return List.of("experiment");
7476
}
7577

7678
@Override
@@ -857,7 +859,7 @@ public void testDeleteLineageParent() throws IOException, CommandException
857859
// create a sample type with the following explicit domain columns
858860
SampleTypeDefinition sampleType = new SampleTypeDefinition("Family");
859861
TestDataGenerator sampleGenerator = sampleType.create(createDefaultConnection(), getProjectName());
860-
862+
861863
sampleGenerator.addRow(List.of("A"));
862864
sampleGenerator.addRow(List.of("B"));
863865
sampleGenerator.addCustomRow(Map.of("name", "C", "MaterialInputs/Family", "A,B"));
@@ -1231,4 +1233,19 @@ public void testDeleteSamplesSomeWithDerivedSamples()
12311233

12321234
}
12331235

1236+
@Test
1237+
public void testDiagnosticActions() throws IOException, CommandException
1238+
{
1239+
// CycleCheckAction: confirm the page loads and the acyclic test data reports no cycles
1240+
beginAt(WebTestHelper.buildURL("experiment", PROJECT_NAME, "cycleCheck"));
1241+
assertTextPresent("This operation can use a lot of memory.");
1242+
clickButton("Continue");
1243+
assertTextPresent("No cycles found");
1244+
1245+
// CheckEdgesAction: confirm the API returns success with an empty cycle list
1246+
var cmd = new SimpleGetCommand("experiment", "checkEdges");
1247+
Map<String, Object> response = cmd.execute(createDefaultConnection(), "/" + PROJECT_NAME).getParsedData();
1248+
assertEquals("CheckEdgesAction should report success", Boolean.TRUE, response.get("success"));
1249+
assertEquals("CheckEdgesAction should find no cycle edges", List.of(), response.get("result"));
1250+
}
12341251
}

0 commit comments

Comments
 (0)