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 early-callback bug in jsftp #642

Merged
merged 3 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ingest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"encodeurl": "^1.0.2",
"fs-extra": "^5.0.0",
"got": "^9.2.1",
"jsftp": "^2.0.0",
"jsftp": "https://github.com/yjpa7145/jsftp.git#Fix-partial-file-issue",
"json-loader": "~0.5.7",
"lodash.clonedeep": "^4.5.0",
"lodash.get": "^4.4.2",
Expand Down
47 changes: 15 additions & 32 deletions tasks/parse-pdr/tests/parse_pdrs_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,24 +291,16 @@ test.serial('Parse a PDR without a granuleIdFilter in the config', async (t) =>
await validateInput(t, t.context.payload.input);
await validateConfig(t, t.context.payload.config);

let output;
try {
output = await parsePdr(t.context.payload);
const output = await parsePdr(t.context.payload);

await validateOutput(t, output);
await validateOutput(t, output);

t.deepEqual(output.pdr, t.context.payload.input.pdr);
t.is(output.granules.length, 2);
t.is(output.granulesCount, 2);
t.is(output.filesCount, 2);
t.is(output.totalSize, 3952643);

t.deepEqual(output.pdr, t.context.payload.input.pdr);
t.is(output.granules.length, 2);
t.is(output.granulesCount, 2);
t.is(output.filesCount, 2);
t.is(output.totalSize, 3952643);
}
catch (err) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we won't need this anymore? This catch seems related to whether Localstack is up/down and not necessarily the FTP issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If localstack is unavailable for some reason then that's an issue that we need to fix.

if (err instanceof errors.RemoteResourceError || err.code === 'AllAccessDisabled') {
t.pass('ignoring this test. Test server seems to be down');
}
else t.fail(err);
}
});

test.serial('Empty FILE_ID valule in PDR, parse-pdr throws error', async (t) => {
Expand Down Expand Up @@ -403,22 +395,13 @@ test.serial('Parse a PDR with a granuleIdFilter in the config', async (t) => {
await validateInput(t, t.context.payload.input);
await validateConfig(t, t.context.payload.config);

let output;
try {
output = await parsePdr(t.context.payload);
const output = await parsePdr(t.context.payload);

await validateOutput(t, output);
await validateOutput(t, output);

t.deepEqual(output.pdr, t.context.payload.input.pdr);
t.is(output.granules.length, 1);
t.is(output.granulesCount, 1);
t.is(output.filesCount, 1);
t.is(output.totalSize, 1503297);
}
catch (err) {
if (err instanceof errors.RemoteResourceError || err.code === 'AllAccessDisabled') {
t.pass('ignoring this test. Test server seems to be down');
}
else t.fail(err);
}
t.deepEqual(output.pdr, t.context.payload.input.pdr);
t.is(output.granules.length, 1);
t.is(output.granulesCount, 1);
t.is(output.filesCount, 1);
t.is(output.totalSize, 1503297);
});