Skip to content

Commit

Permalink
Node: fix flaky test (#2657)
Browse files Browse the repository at this point in the history
fix tests

Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand authored Dec 10, 2024
1 parent 03c7753 commit 3542b2a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"fix-protobuf-file": "replace 'this\\.encode\\(message, writer\\)\\.ldelim' 'this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim' src/ProtobufMessage.js",
"test": "npm run build-test-utils && jest --verbose --testPathIgnorePatterns='ServerModules'",
"test-dbg": "npm run build-test-utils && jest --runInBand",
"test-minimum": "npm run build-test-utils && jest --verbose --testNamePattern='^(.(?!(GlideJson|GlideFt|pubsub|kill)))*$'",
"test-modules": "npm run build-test-utils && jest --verbose --testNamePattern='(GlideJson|GlideFt)'",
"test-minimum": "npm run build-test-utils && jest --verbose --runInBand --testNamePattern='^(.(?!(GlideJson|GlideFt|pubsub|kill)))*$'",
"test-modules": "npm run build-test-utils && jest --verbose --runInBand --testNamePattern='(GlideJson|GlideFt)'",
"build-test-utils": "cd ../utils && npm i && npm run build",
"lint:fix": "npm run install-linting && npx eslint -c ../eslint.config.mjs --fix && npm run prettier:format",
"lint": "npm run install-linting && npx eslint -c ../eslint.config.mjs && npm run prettier:check:ci",
Expand Down
6 changes: 4 additions & 2 deletions node/tests/GlideClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,16 @@ describe("GlideClient", () => {
);
const key1 = uuidv4();
const key2 = uuidv4();
const value = uuidv4();
const value = "value";

const transaction1 = new Transaction().set(key1, value).dump(key1);

// Since DUMP gets binary results, we cannot use the string decoder here, so we expected to get an error.
await expect(
client.exec(transaction1, { decoder: Decoder.String }),
).rejects.toThrow("invalid utf-8 sequence of");
).rejects.toThrow(
/invalid utf-8 sequence|incomplete utf-8 byte sequence/,
);

const result = await client.exec(transaction1, {
decoder: Decoder.Bytes,
Expand Down
4 changes: 2 additions & 2 deletions node/tests/GlideClusterClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,13 @@ describe("GlideClusterClient", () => {
getClientConfigurationOption(cluster.getAddresses(), protocol),
);

const key = "key";
const key = uuidv4();
const value = "value";
const valueEncoded = Buffer.from(value);
expect(await client.set(key, value)).toEqual("OK");
// Since DUMP gets binary results, we cannot use the default decoder (string) here, so we expected to get an error.
await expect(client.customCommand(["DUMP", key])).rejects.toThrow(
"invalid utf-8 sequence",
/invalid utf-8 sequence|incomplete utf-8 byte sequence/,
);

const dumpResult = await client.customCommand(["DUMP", key], {
Expand Down

0 comments on commit 3542b2a

Please sign in to comment.