Skip to content

Commit

Permalink
Adapting HarvestingClient and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenferey committed Dec 13, 2024
1 parent d483ae2 commit 0c7aeb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public ClientHarvestRun getLastSuccessfulRun() {
int i = harvestHistory.size() - 1;

while (i > -1) {
if (harvestHistory.get(i).isCompleted()) {
if (harvestHistory.get(i).isCompleted() || harvestHistory.get(i).isCompletedWithFailures()) {
return harvestHistory.get(i);
}
i--;
Expand All @@ -314,7 +314,7 @@ ClientHarvestRun getLastNonEmptyRun() {
int i = harvestHistory.size() - 1;

while (i > -1) {
if (harvestHistory.get(i).isCompleted()) {
if (harvestHistory.get(i).isCompleted() || harvestHistory.get(i).isCompletedWithFailures()) {
if (harvestHistory.get(i).getHarvestedDatasetCount().longValue() > 0 ||
harvestHistory.get(i).getDeletedDatasetCount().longValue() > 0) {
return harvestHistory.get(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private void harvestingClientRun(boolean allowHarvestingMissingCVV) throws Inte
assertEquals("inActive", clientStatus, "Unexpected client status: "+clientStatus);

// b) Confirm that it has actually succeeded:
assertEquals("SUCCESS", responseJsonPath.getString("data.lastResult"), "Last harvest not reported a success (took "+i+" seconds)");
assertTrue(responseJsonPath.getString("data.lastResult").contains("Completed"), "Last harvest not reported a success (took "+i+" seconds)");
String harvestTimeStamp = responseJsonPath.getString("data.lastHarvest");
assertNotNull(harvestTimeStamp);

Expand All @@ -288,6 +288,8 @@ private void harvestingClientRun(boolean allowHarvestingMissingCVV) throws Inte

// Let's give the asynchronous indexing an extra sec. to finish:
Thread.sleep(1000L);
// Requires the index-harvested-metadata-source Flag feature to be enabled to search on the nickName
// Otherwise, the search must be performed with metadataSource:Harvested
Response searchHarvestedDatasets = UtilIT.search("metadataSource:" + nickName, normalUserAPIKey);
searchHarvestedDatasets.then().assertThat().statusCode(OK.getStatusCode());
searchHarvestedDatasets.prettyPrint();
Expand Down

0 comments on commit 0c7aeb4

Please sign in to comment.