mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-29 04:57:48 +01:00
Compare commits
2 Commits
1adcecb850
...
256f21a6e7
| Author | SHA1 | Date | |
|---|---|---|---|
| 256f21a6e7 | |||
| df1db4767f |
@@ -322,6 +322,49 @@ public class DhfsFuseIT {
|
||||
// Assertions.assertTrue(ls.getStdout().chars().filter(c -> c == '\n').count() >= 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void dirCycleTest() throws IOException, InterruptedException, TimeoutException {
|
||||
Assertions.assertEquals(0, container1.execInContainer("/bin/sh", "-c", "ls /root/dhfs_default/fuse").getExitCode());
|
||||
Assertions.assertEquals(0, container1.execInContainer("/bin/sh", "-c", "mkdir /root/dhfs_default/fuse/a").getExitCode());
|
||||
Assertions.assertEquals(0, container1.execInContainer("/bin/sh", "-c", "mkdir /root/dhfs_default/fuse/b").getExitCode());
|
||||
Assertions.assertEquals(0, container1.execInContainer("/bin/sh", "-c", "echo xqr489 >> /root/dhfs_default/fuse/a/testfa").getExitCode());
|
||||
Assertions.assertEquals(0, container1.execInContainer("/bin/sh", "-c", "echo ahinou >> /root/dhfs_default/fuse/b/testfb").getExitCode());
|
||||
Thread.sleep(1000);
|
||||
Assertions.assertEquals(0, container2.execInContainer("/bin/sh", "-c", "ls -lavh /root/dhfs_default/fuse").getExitCode());
|
||||
var c2ls = container2.execInContainer("/bin/sh", "-c", "find /root/dhfs_default/fuse -type f -exec cat {} \\;");
|
||||
Assertions.assertEquals(0, c2ls.getExitCode());
|
||||
Assertions.assertTrue(c2ls.getStdout().contains("xqr489"));
|
||||
Assertions.assertTrue(c2ls.getStdout().contains("ahinou"));
|
||||
Thread.sleep(1000);
|
||||
|
||||
var client = DockerClientFactory.instance().client();
|
||||
client.pauseContainerCmd(container1.getContainerId()).exec();
|
||||
Assertions.assertEquals(0, container2.execInContainer("/bin/sh", "-c", "mv /root/dhfs_default/fuse/a /root/dhfs_default/fuse/b").getExitCode());
|
||||
client.pauseContainerCmd(container2.getContainerId()).exec();
|
||||
client.unpauseContainerCmd(container1.getContainerId()).exec();
|
||||
Assertions.assertEquals(0, container1.execInContainer("/bin/sh", "-c", "mv /root/dhfs_default/fuse/b /root/dhfs_default/fuse/a").getExitCode());
|
||||
client.unpauseContainerCmd(container2.getContainerId()).exec();
|
||||
|
||||
Thread.sleep(10000);
|
||||
Log.info(container1.execInContainer("/bin/sh", "-c", "ls /root/dhfs_default/fuse"));
|
||||
Log.info(container1.execInContainer("/bin/sh", "-c", "ls /root/dhfs_default/fuse/a"));
|
||||
Log.info(container1.execInContainer("/bin/sh", "-c", "ls /root/dhfs_default/fuse/b"));
|
||||
Log.info(container2.execInContainer("/bin/sh", "-c", "ls /root/dhfs_default/fuse"));
|
||||
Log.info(container2.execInContainer("/bin/sh", "-c", "ls /root/dhfs_default/fuse/a"));
|
||||
Log.info(container2.execInContainer("/bin/sh", "-c", "ls /root/dhfs_default/fuse/b"));
|
||||
// FIXME: An infinite cycle can indeed be created
|
||||
var c1ls2 = container1.execInContainer("/bin/sh", "-c", "find /root/dhfs_default/fuse -maxdepth 3 -type f -exec cat {} \\;");
|
||||
Log.info(c1ls2);
|
||||
Assertions.assertEquals(0, c1ls2.getExitCode());
|
||||
Assertions.assertTrue(c1ls2.getStdout().contains("xqr489"));
|
||||
Assertions.assertTrue(c1ls2.getStdout().contains("ahinou"));
|
||||
var c2ls2 = container1.execInContainer("/bin/sh", "-c", "find /root/dhfs_default/fuse -maxdepth 3 -type f -exec cat {} \\;");
|
||||
Log.info(c2ls2);
|
||||
Assertions.assertEquals(0, c2ls2.getExitCode());
|
||||
Assertions.assertTrue(c2ls2.getStdout().contains("xqr489"));
|
||||
Assertions.assertTrue(c2ls2.getStdout().contains("ahinou"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void dirConflictTest2() throws IOException, InterruptedException, TimeoutException {
|
||||
Assertions.assertEquals(0, container1.execInContainer("/bin/sh", "-c", "ls /root/dhfs_default/fuse").getExitCode());
|
||||
|
||||
@@ -87,7 +87,7 @@ public class HashSetDelayedBlockingQueueTest {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(500);
|
||||
var got1 = queue.getAllWait(3);
|
||||
var got2 = queue.getAllWait(3);
|
||||
Assertions.assertEquals(3, got1.size());
|
||||
|
||||
Reference in New Issue
Block a user