Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix read-lock tests #2889

Merged
merged 1 commit into from
Aug 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void fileWatchCreateUpdate() throws IOException, InterruptedException {
@Test
public void fileReadLock_minLength() throws Exception {
// Create a new file
String fileName = RestAssured.given()
String filePath = RestAssured.given()
.contentType(ContentType.BINARY)
.body(new byte[] {})
.post("/file/create/{name}", FileRoutes.READ_LOCK_IN)
Expand All @@ -223,13 +223,27 @@ public void fileReadLock_minLength() throws Exception {
.body()
.asString();

String fileName = Paths.get(filePath).getFileName().toString();

Thread.sleep(10_000L);

// Read the file that should not be there
// Read the file that should not be there (.done folder)
RestAssured
.get("/file/get/{folder}/{name}", FileRoutes.READ_LOCK_IN + "/.done", fileName)
.then()
.statusCode(204);

// Read the file that should not be there (output folder)
RestAssured
.get("/file/get/{folder}/{name}", FileRoutes.READ_LOCK_OUT, Paths.get(fileName).getFileName())
.get("/file/get/{folder}/{name}", FileRoutes.READ_LOCK_OUT, fileName)
.then()
.statusCode(204);

// Read the file that should be there (input folder)
RestAssured
.get("/file/get/{folder}/{name}", FileRoutes.READ_LOCK_IN, fileName)
.then()
.statusCode(200);
}

@Test
Expand Down