Skip to content

Commit

Permalink
Checking jobID instead of metadata...the SDK says it exists but the e…
Browse files Browse the repository at this point in the history
…rror messages say it does not
  • Loading branch information
jim-sheldon committed Jun 7, 2021
1 parent 812cb43 commit 3314397
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ export default class AwsBatchClient {
: undefined
})
.promise();
let response = res as any;
if (response.$metadata.httpStatusCode != 200){
logger.error(response);
if (!res.jobId) {
logger.error(res);
throw Error(
`Retrieving source "${sourceId}" content: ${response.$metadata}`,
`Retrieving source "${sourceId}" content: ${res}`,
);
}
let ret = {jobName: res.jobName};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ describe('doRetrieval', () => {
};
submitJobSpy.mockResolvedValueOnce({
jobName: ingestorName,
$metadata: {
httpStatusCode: 200
}
jobId: ingestorName
});
describeJobDefinitionsSpy.mockResolvedValueOnce(mockJobDefinitions);
const res = await client.doRetrieval(sourceID, {
Expand All @@ -82,12 +80,9 @@ describe('doRetrieval', () => {
expectedError,
);
});
it('throws when the aws api returns an non-200 from the submit job call', async () => {
it('throws when the aws api does not return a jobID from the submit job call', async () => {
describeJobDefinitionsSpy.mockResolvedValueOnce(mockJobDefinitions);
const metadata = {httpStatusCode: 400};
submitJobSpy.mockResolvedValueOnce({
$metadata: metadata
});
submitJobSpy.mockResolvedValueOnce({});
return expect(client.doRetrieval(sourceID)).rejects.toThrowError(
);
});
Expand Down

0 comments on commit 3314397

Please sign in to comment.