Skip to content

Commit d5b909a

Browse files
More claude code review feedback.
1 parent 98d0272 commit d5b909a

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/org/labkey/test/TestFileUtils.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,9 @@ public static void deleteDir(File dir)
450450
* Rename a directory.
451451
* @param sourceDir the directory to rename
452452
* @param newDirName the new name for the directory
453+
* @return return the path to the renamed directory
453454
*/
454-
public static void renameDir(Path sourceDir, String newDirName) throws IOException
455+
public static Path renameDir(Path sourceDir, String newDirName) throws IOException
455456
{
456457
LOG.info("Renaming {} to {}", sourceDir, newDirName);
457458

@@ -465,7 +466,9 @@ public static void renameDir(Path sourceDir, String newDirName) throws IOExcepti
465466
: Paths.get(newDirName);
466467
Files.move(sourceDir, newDir);
467468

468-
LOG.info("Rename successful.");
469+
LOG.info("Renamed {} to {}", sourceDir, newDir);
470+
471+
return newDir;
469472
}
470473

471474
private static void checkFileLocation(File file)

src/org/labkey/test/tests/assay/AssayTransformMissingParentDirTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,20 @@ public void testMissingParentDirectoryRegression() throws Exception
4646
assayDesignerPage.goToBatchFields().removeAllFields(true);
4747
// add by path so the absolute path is stored; this allows reproducing the missing parent dir scenario
4848
assayDesignerPage.addTransformScript(transformFile);
49-
getArtifactCollector().dumpPageSnapshot("TransformScript_Added");
5049
assayDesignerPage.clickSave();
5150

52-
// Now rename the parent dir to ensure we handle it reasonably. Deleting directories on Windows is not always
51+
// Rename the parent dir to ensure we handle it reasonably. Deleting directories on Windows is not always
5352
// timely, renaming the directory will have the same effect.
5453
String newName = "Not-Here-" + UUID.randomUUID();
55-
TestFileUtils.renameDir(parentDir, newName);
54+
Path renamedDir = TestFileUtils.renameDir(parentDir, newName);
5655

5756
Assert.assertFalse(String.format("Directory %s is still present.", parentDir),
5857
FileUtils.isDirectory(parentDir.toFile()));
5958

59+
// Delete the renamed directory as a cleanup step. Since the directory has been renamed, the slow delete on Windows
60+
// will not cause the test to fail.
61+
TestFileUtils.deleteDir(renamedDir.toFile());
62+
6063
// Attempt to import data and verify a reasonable error message is shown
6164
String importData = """
6265
VisitID\tParticipantID\tComment
@@ -94,6 +97,7 @@ public void testMissingParentDirectoryRegression() throws Exception
9497

9598
// Verify we land on the run details page and can see the run name (no transform needed)
9699
new AssayRunsPage(getDriver()).clickAssayIdLink("fixedAssayImport");
100+
97101
}
98102

99103
}

0 commit comments

Comments
 (0)