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

Node: update transactions binary args returns #2193

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4f63815
Node: update transaction tests to accept/return binary
acarbonetto Aug 23, 2024
e023ad7
Fix tests
acarbonetto Aug 23, 2024
8ac5a40
Revert encoded tests
acarbonetto Aug 23, 2024
4038430
Clean up; prettier
acarbonetto Aug 23, 2024
e90a0e3
Merge conflicts
acarbonetto Sep 11, 2024
6a065e3
Fix tests
acarbonetto Sep 11, 2024
60651e9
fix tests
acarbonetto Sep 11, 2024
9791659
Linter
acarbonetto Sep 12, 2024
5d8da9a
Fix tests
acarbonetto Sep 12, 2024
1927dbe
Fix imports
acarbonetto Sep 12, 2024
5a98075
Fix tests
acarbonetto Sep 12, 2024
1362331
Fix tests
acarbonetto Sep 12, 2024
26ac586
Fix transaction tests
acarbonetto Sep 12, 2024
fb44886
linter
acarbonetto Sep 12, 2024
744ea01
Return only strings
acarbonetto Sep 13, 2024
109bbeb
Fix tests
acarbonetto Sep 13, 2024
52067bd
test transaction response as strings
acarbonetto Sep 13, 2024
00c34de
Fix tests
acarbonetto Sep 13, 2024
002696c
Ensure strings return
acarbonetto Sep 13, 2024
2026da0
Fix more tests
acarbonetto Sep 13, 2024
67312d8
Fix last tests
acarbonetto Sep 13, 2024
711d7ba
Fix last tests
acarbonetto Sep 13, 2024
48a0f7b
fix test runner
acarbonetto Sep 18, 2024
d3dada0
Fix more tests
acarbonetto Sep 18, 2024
09507fc
Linter
acarbonetto Sep 18, 2024
9fde914
prettier
acarbonetto Sep 18, 2024
7b2d212
Update tests with describe.each
acarbonetto Sep 19, 2024
7e4f202
Fix transaction tests
acarbonetto Dec 11, 2024
8ccb2d7
Fix merge conflicts
acarbonetto Dec 11, 2024
a8f7883
linter
acarbonetto Dec 11, 2024
03d7567
Remove dump/restore transaction changes
acarbonetto Dec 11, 2024
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
49 changes: 33 additions & 16 deletions node/tests/GlideClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,23 +269,40 @@ describe("GlideClient", () => {
},
);

it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
`can send transactions_%p`,
async (protocol) => {
client = await GlideClient.createClient(
getClientConfigurationOption(cluster.getAddresses(), protocol),
);
const transaction = new Transaction();
const expectedRes = await transactionTest(
transaction,
cluster.getVersion(),
describe.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
"Protocol is RESP2 = %s",
(protocol) => {
describe.each([Decoder.String, Decoder.Bytes])(
"Decoder String = %s",
(decoder) => {
it(
"can send transactions",
async () => {
client = await GlideClient.createClient(
getClientConfigurationOption(
cluster.getAddresses(),
protocol,
),
);
const transaction = new Transaction();
const expectedRes = await transactionTest(
transaction,
cluster,
decoder,
);
transaction.select(0);
const result = await client.exec(transaction, {
decoder: Decoder.String,
});
expectedRes.push(["select(0)", "OK"]);

validateTransactionResponse(result, expectedRes);
client.close();
},
TIMEOUT,
);
},
);
transaction.select(0);
const result = await client.exec(transaction);
expectedRes.push(["select(0)", "OK"]);

validateTransactionResponse(result, expectedRes);
client.close();
},
);

Expand Down
68 changes: 45 additions & 23 deletions node/tests/GlideClusterClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
SortOrder,
convertRecordToGlideRecord,
} from "..";
import { ValkeyCluster } from "../../utils/TestUtils.js";
import { ValkeyCluster } from "../../utils/TestUtils";
acarbonetto marked this conversation as resolved.
Show resolved Hide resolved
import { runBaseTests } from "./SharedTests";
import {
checkClusterResponse,
Expand Down Expand Up @@ -328,33 +328,55 @@ describe("GlideClusterClient", () => {
TIMEOUT,
);

it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
`can send transactions_%p`,
async (protocol) => {
client = await GlideClusterClient.createClient(
getClientConfigurationOption(cluster.getAddresses(), protocol),
);
const transaction = new ClusterTransaction();
describe.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
"Protocol is RESP2 = %s",
(protocol) => {
describe.each([Decoder.String, Decoder.Bytes])(
"Decoder String = %s",
(decoder) => {
it(
"can send transactions",
async () => {
client = await GlideClusterClient.createClient(
getClientConfigurationOption(
cluster.getAddresses(),
protocol,
),
);

const expectedRes = await transactionTest(
transaction,
cluster.getVersion(),
);
const transaction = new ClusterTransaction();

if (!cluster.checkIfServerVersionLessThan("7.0.0")) {
transaction.publish("message", "key", true);
expectedRes.push(['publish("message", "key", true)', 0]);
const expectedRes = await transactionTest(
transaction,
cluster,
decoder,
);

transaction.pubsubShardChannels();
expectedRes.push(["pubsubShardChannels()", []]);
transaction.pubsubShardNumSub([]);
expectedRes.push(["pubsubShardNumSub()", []]);
}
if (
!cluster.checkIfServerVersionLessThan("7.0.0")
) {
transaction.publish("message", "key", true);
expectedRes.push([
'publish("message", "key", true)',
0,
]);

const result = await client.exec(transaction);
validateTransactionResponse(result, expectedRes);
transaction.pubsubShardChannels();
expectedRes.push(["pubsubShardChannels()", []]);
transaction.pubsubShardNumSub([]);
expectedRes.push(["pubsubShardNumSub()", []]);
}

const result = await client.exec(transaction, {
decoder: Decoder.String,
});
validateTransactionResponse(result, expectedRes);
},
TIMEOUT,
);
},
);
},
TIMEOUT,
);

it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
Expand Down
Loading
Loading