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

rf: ZENKO-285 Single test for range calculation #274

Merged
merged 1 commit into from
May 31, 2018
Merged
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
25 changes: 13 additions & 12 deletions tests/unit/replication/MultipleBackendTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,28 @@ describe('MultipleBackendTask', () => {
});
});

Array.from(Array(10000 - 1024).keys()).forEach(n => {
const count = n + 1025;
const ranges = task._getRanges(count * partSize);
const contentLen = count * partSize;
const pow = Math.pow(2,
Math.ceil(Math.log(contentLen) / Math.log(2)));
const range = pow / MPU_GCP_MAX_PARTS;
it(`should get list of 1024 ranges: ${count} parts`, () => {
assert.strictEqual(ranges.length <= 1024, true);
it(`should get <= 1024 ranges for part count 1025-10000`, () => {
Array.from(Array(10000 - 1024).keys()).forEach(n => {
const count = n + 1025;
const ranges = task._getRanges(count * partSize);
const contentLen = count * partSize;
const pow = Math.pow(2,
Math.ceil(Math.log(contentLen) / Math.log(2)));
const range = pow / MPU_GCP_MAX_PARTS;
const msg = `incorrect value for part count: ${count}`;
assert.strictEqual(ranges.length <= 1024, true, msg);
assert.deepStrictEqual(ranges[0], {
start: 0,
end: range - 1,
});
}, msg);
assert.deepStrictEqual(ranges[1], {
start: range,
end: range * 2 - 1,
});
}, msg);
assert.deepStrictEqual(ranges[ranges.length - 1], {
start: range * (ranges.length - 1),
end: contentLen - 1,
});
}, msg);
});
});
});
Expand Down