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

KEP-1703 Update tests for 0.7 #56

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bluzelle-js
18 changes: 9 additions & 9 deletions tests/functional/basic-functionality.test.js
Expand Up @@ -32,19 +32,19 @@ const {generateString} = require('../../src/utils');

it(`should be able to create`, async function () {
for (let i = 0; i < numberOfKeys; i ++) {
await this.api.create(`key-${i}`, VALUE)
await this.api.create(`key-${i}`, VALUE).timeout(harnessConfigs.clientOperationTimeout)
}
});

it(`should be able to read`, async function () {
for (let i = 0; i < numberOfKeys; i ++) {
(await this.api.read(`key-${i}`)).should.be.equal(VALUE);
(await this.api.read(`key-${i}`).timeout(harnessConfigs.clientOperationTimeout)).should.be.equal(VALUE);
}
});

it(`should be able to quickread`, async function () {
for (let i = 0; i < numberOfKeys; i ++) {
(await this.api.quickread(`key-${i}`)).should.be.equal(VALUE);
(await this.api.quickread(`key-${i}`).timeout(harnessConfigs.clientOperationTimeout)).should.be.equal(VALUE);
}
});

Expand All @@ -54,35 +54,35 @@ const {generateString} = require('../../src/utils');
const NEW_VALUE = VALUE.slice(0, -1) + 'A';

for (let i = 0; i < numberOfKeys; i ++) {
await this.api.update(`key-${i}`, NEW_VALUE);
await this.api.update(`key-${i}`, NEW_VALUE).timeout(harnessConfigs.clientOperationTimeout);
}

for (let i = 0; i < numberOfKeys; i ++) {
(await this.api.read(`key-${i}`)).should.be.equal(NEW_VALUE);
(await this.api.read(`key-${i}`).timeout(harnessConfigs.clientOperationTimeout)).should.be.equal(NEW_VALUE);
}
});

it(`should be able to get all keys`, async function () {
(await this.api.keys()).should.have.lengthOf(numberOfKeys);
(await this.api.keys().timeout(harnessConfigs.clientOperationTimeout)).should.have.lengthOf(numberOfKeys);
});

it(`should be able to has all keys`, async function () {
for (let i = 0; i < numberOfKeys; i ++) {
await this.api.has(`key-${i}`);
await this.api.has(`key-${i}`).timeout(harnessConfigs.clientOperationTimeout);
}
});

it(`should be able to delete all keys`, async function () {
this.timeout(numberOfKeys * harnessConfigs.keyCreationTimeoutMultiplier * 2);

for (let i = 0; i < numberOfKeys; i ++) {
await this.api.delete(`key-${i}`);
await this.api.delete(`key-${i}`).timeout(harnessConfigs.clientOperationTimeout);
}

(await this.api.keys()).should.have.lengthOf(0);

for (let i = 0; i < numberOfKeys; i ++) {
(await this.api.has(`key-${i}`)).should.be.equal(false);
(await this.api.has(`key-${i}`).timeout(harnessConfigs.clientOperationTimeout)).should.be.equal(false);
}
});
});
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/ttl.test.js
Expand Up @@ -152,14 +152,14 @@ const delay = require('delay');
(harnessConfigs.testRemoteSwarm ? remoteSwarmHook() : localSwarmHooks({preserveSwarmState: false}));

before('create keys', function () {
this.timeout(testCases.hookTimeout(ctx));
this.timeout(testCases.hookTimeout(ctx) * 2);

this.expiryTimes = generateExpiryTimes(ctx.numOfKeys, testCases.minimumDelay(ctx), ctx.expiryMultiplier);
this.sortedExpiryTimes = this.expiryTimes.slice().sort((a, b) => a - b);
this.medianDelay = this.sortedExpiryTimes[this.sortedExpiryTimes.length / 2];

return this.expiryTimes.reduce((p, expiryTime, idx) =>
p.then(() => this.api.create(`expiry-${idx}`, generateString(ctx.valueSize), expiryTime)),
p.then(() => this.api.create(`expiry-${idx}`, generateString(ctx.valueSize), expiryTime).timeout(harnessConfigs.clientOperationTimeout)),
Promise.resolve());
});

Expand Down