use of bio.terra.model.JobModel in project jade-data-repo by DataBiosphere.
the class IngestTest method ingestBadPathTest.
@Test
public void ingestBadPathTest() throws Exception {
IngestRequestModel request = dataRepoFixtures.buildSimpleIngest("file", "totally-legit-file.json");
DataRepoResponse<JobModel> ingestJobResponse = dataRepoFixtures.ingestJsonDataLaunch(steward(), datasetId, request);
DataRepoResponse<IngestResponseModel> ingestResponse = dataRepoClient.waitForResponse(steward(), ingestJobResponse, IngestResponseModel.class);
assertThat("ingest failed", ingestResponse.getStatusCode(), equalTo(HttpStatus.NOT_FOUND));
assertThat("failure is explained", ingestResponse.getErrorObject().orElseThrow(IllegalStateException::new).getMessage(), containsString("not found"));
}
use of bio.terra.model.JobModel in project jade-data-repo by DataBiosphere.
the class IngestTest method ingestBadMultiWildcardTest.
@Test
public void ingestBadMultiWildcardTest() throws Exception {
IngestRequestModel request = dataRepoFixtures.buildSimpleIngest("file", "ingest-prefix/*/ingest/suffix/*.json");
DataRepoResponse<JobModel> ingestJobResponse = dataRepoFixtures.ingestJsonDataLaunch(steward(), datasetId, request);
DataRepoResponse<IngestResponseModel> ingestResponse = dataRepoClient.waitForResponse(steward(), ingestJobResponse, IngestResponseModel.class);
assertThat("ingest failed", ingestResponse.getStatusCode(), equalTo(HttpStatus.BAD_REQUEST));
assertThat("failure is explained", ingestResponse.getErrorObject().orElseThrow(IllegalStateException::new).getMessage(), containsString("not supported"));
}
use of bio.terra.model.JobModel in project jade-data-repo by DataBiosphere.
the class IngestTest method ingestUnauthorizedTest.
@Test
public void ingestUnauthorizedTest() throws Exception {
IngestRequestModel request = dataRepoFixtures.buildSimpleIngest("participant", "ingest-test/ingest-test-participant.json");
DataRepoResponse<JobModel> ingestCustResp = dataRepoFixtures.ingestJsonDataLaunch(custodian(), datasetId, request);
assertThat("Custodian is not authorized to ingest data", ingestCustResp.getStatusCode(), equalTo(HttpStatus.UNAUTHORIZED));
DataRepoResponse<JobModel> ingestReadResp = dataRepoFixtures.ingestJsonDataLaunch(reader(), datasetId, request);
assertThat("Reader is not authorized to ingest data", ingestReadResp.getStatusCode(), equalTo(HttpStatus.UNAUTHORIZED));
}
use of bio.terra.model.JobModel in project jade-data-repo by DataBiosphere.
the class IngestTest method ingestSingleFileMalformedTest.
@Test
public void ingestSingleFileMalformedTest() throws Exception {
IngestRequestModel request = dataRepoFixtures.buildSimpleIngest("file", "ingest-test/ingest-test-prtcpnt-malformed.json");
DataRepoResponse<JobModel> ingestJobResponse = dataRepoFixtures.ingestJsonDataLaunch(steward(), datasetId, request);
DataRepoResponse<IngestResponseModel> ingestResponse = dataRepoClient.waitForResponse(steward(), ingestJobResponse, IngestResponseModel.class);
assertThat("ingest failed", ingestResponse.getStatusCode(), equalTo(HttpStatus.BAD_REQUEST));
assertThat("failure is explained", ingestResponse.getErrorObject().orElseThrow(IllegalStateException::new).getErrorDetail(), hasItem(containsString("too many errors")));
}
use of bio.terra.model.JobModel in project jade-data-repo by DataBiosphere.
the class FileTest method fileParallelFailedLoadTest.
// DR-612 filesystem corruption test; use a non-existent file to make sure everything errors
// Do file ingests in parallel using a filename that will cause failure
@Test
public void fileParallelFailedLoadTest() throws Exception {
List<DataRepoResponse<JobModel>> responseList = new ArrayList<>();
String gsPath = "gs://" + testConfiguration.getIngestbucket() + "/nonexistentfile";
String filePath = "/foo" + UUID.randomUUID().toString() + "/bar";
for (int i = 0; i < 20; i++) {
DataRepoResponse<JobModel> launchResp = dataRepoFixtures.ingestFileLaunch(steward(), datasetId, profileId, gsPath, filePath + i);
responseList.add(launchResp);
}
int failureCount = 0;
for (DataRepoResponse<JobModel> resp : responseList) {
DataRepoResponse<FileModel> response = dataRepoClient.waitForResponse(steward(), resp, FileModel.class);
if (response.getStatusCode() == HttpStatus.NOT_FOUND) {
System.out.println("Got expected not found");
} else {
System.out.println("Unexpected: " + response.getStatusCode().toString());
if (response.getErrorObject().isPresent()) {
ErrorModel errorModel = response.getErrorObject().get();
System.out.println("Error: " + errorModel.getMessage());
}
failureCount++;
}
}
assertThat("No unexpected failures", failureCount, equalTo(0));
}
Aggregations