Skip to content

Commit f8b753f

Browse files
committed
fix flaky test
1 parent b3e1c78 commit f8b753f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,7 +3324,8 @@ public void testUploadFilesWithLimits() throws JsonParseException {
33243324
uploadFileResponse.then().assertThat()
33253325
.statusCode(OK.getStatusCode());
33263326
String fileId = String.valueOf(JsonPath.from(uploadFileResponse.body().asString()).getInt("data.files[0].dataFile.id"));
3327-
UtilIT.sleepForLock(datasetId, null, apiToken, UtilIT.MAXIMUM_INGEST_LOCK_DURATION);
3327+
3328+
assertTrue(UtilIT.sleepForLock(datasetId, "Ingest", apiToken, UtilIT.MAXIMUM_INGEST_LOCK_DURATION), "Failed test if Ingest Lock exceeds max duration " + pathToFile);
33283329

33293330
// upload a second file should fail since the limit is 1 file per dataset
33303331
pathToFile = "scripts/search/data/tabular/open-source-at-harvard118.dta";
@@ -3345,7 +3346,8 @@ public void testUploadFilesWithLimits() throws JsonParseException {
33453346
uploadFileResponse.prettyPrint();
33463347
uploadFileResponse.then().assertThat()
33473348
.statusCode(OK.getStatusCode());
3348-
UtilIT.sleepForLock(datasetId, null, apiToken, UtilIT.MAXIMUM_INGEST_LOCK_DURATION);
3349+
3350+
assertTrue(UtilIT.sleepForLock(datasetId, "Ingest", apiToken, UtilIT.MAXIMUM_INGEST_LOCK_DURATION), "Failed test if Ingest Lock exceeds max duration " + pathToFile);
33493351

33503352
// Set limit back to 1 even though the number of files is 2
33513353
dv.setDatasetFileCountLimit(1);
@@ -3369,6 +3371,8 @@ public void testUploadFilesWithLimits() throws JsonParseException {
33693371
replaceFileResponse.then().assertThat()
33703372
.statusCode(OK.getStatusCode());
33713373

3374+
assertTrue(UtilIT.sleepForLock(datasetId, "Ingest", apiToken, UtilIT.MAXIMUM_INGEST_LOCK_DURATION), "Failed test if Ingest Lock exceeds max duration " + pathToFile);
3375+
33723376
// Superuser file uploads can exceed the limit!
33733377
pathToFile = "scripts/search/data/tabular/stata13-auto.dta";
33743378
uploadFileResponse = UtilIT.uploadFileViaNative(datasetId.toString(), pathToFile, apiToken);
@@ -3380,6 +3384,8 @@ public void testUploadFilesWithLimits() throws JsonParseException {
33803384
uploadFileResponse.then().assertThat()
33813385
.statusCode(OK.getStatusCode());
33823386

3387+
assertTrue(UtilIT.sleepForLock(datasetId, "Ingest", adminApiToken, UtilIT.MAXIMUM_INGEST_LOCK_DURATION), "Failed test if Ingest Lock exceeds max duration " + pathToFile);
3388+
33833389
// Test changing the limit by a non-superuser
33843390
dv.setDatasetFileCountLimit(100);
33853391
updateDataverseResponse = UtilIT.updateDataverse(dataverseAlias, dv, apiToken);

0 commit comments

Comments
 (0)