Skip to content

Commit

Permalink
SNOW-979081: Simplify perf test names format
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz committed Jul 29, 2024
1 parent a09d2f1 commit 8ce4d14
Showing 1 changed file with 38 additions and 36 deletions.
74 changes: 38 additions & 36 deletions test/integration/generic/generic_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,37 @@ describe.only('test generic binding', () => {
assert.equal(connectionId, null);
});

it('should execute queries with bind parameters', () => {
const connectionId = generic.connectUserPassword(connectionParams);
let result = generic.executeQuery(connectionId, 'create or replace table generic_1 (id int, data text);');
assert.deepEqual(result, [['Table GENERIC_1 successfully created.']]);
result = generic.executeQuery(connectionId, 'insert into generic_1 (id, data) values (?, ?)', {
binds: [1, 'test żółć']
});
assert.deepEqual(result, [[1]], 'insert'); // one inserted row
result = generic.executeQuery(connectionId, 'select id, data from generic_1 where id = ?', {
binds: [1]
});
assert.deepEqual(result, [[1, 'test żółć']], 'select after insert');
result = generic.executeQuery(connectionId, 'update generic_1 set data = ? where id = ?', {
binds: ['test 2', 1]
});
assert.deepEqual(result, [[1, 0]], 'update'); // one updated row, 0 number of multi-joined rows updated
result = generic.executeQuery(connectionId, 'select id, data from generic_1 where id = ?', {
binds: [1]
});
assert.deepEqual(result, [[1, 'test 2']], 'select after update');
result = generic.executeQuery(connectionId, 'delete from generic_1 where id = ?', {
binds: [1]
});
assert.deepEqual(result, [[1]], 'delete'); // one deleted row
result = generic.executeQuery(connectionId, 'select id, data from generic_1 where id = ?', {
binds: [1]
});
assert.deepEqual(result, [], 'select after delete');
generic.closeConnection(connectionId);
});

describe('Perf selects', () => {
['JSON', 'ARROW'].forEach(resultFormat => {
let connectionId;
Expand All @@ -68,7 +99,7 @@ describe.only('test generic binding', () => {
});

[10, 10000, 1000000].forEach(sourceRowCount => {
it(`should select ${sourceRowCount} rows in ${resultFormat}`, () => {
it(`GENERIC|${sourceRowCount}|${resultFormat}|ROWS`, () => {
const result = generic.executeQuery(connectionId,
`select randstr(10, random())
from table (generator(rowcount =>${sourceRowCount}))`);
Expand All @@ -80,7 +111,7 @@ describe.only('test generic binding', () => {
});
});

it(`should select ${sourceRowCount} rows in ${resultFormat} with delayed rows fetch`, () => {
it(`GENERIC|${sourceRowCount}|${resultFormat}|DELAYED`, () => {
const streamRowsSize = 1000;
const statementId = generic.executeQueryWithoutFetchingRows(connectionId,
`select randstr(10, random())
Expand All @@ -103,7 +134,7 @@ describe.only('test generic binding', () => {
assert.equal(fetchedRows, sourceRowCount);
});

it(`should select ${sourceRowCount} rows in ${resultFormat} with streaming`, () => {
it(`GENERIC|${sourceRowCount}|${resultFormat}|STREAM`, () => {
let fetchedRows = 0;
let invalidRows = 0;
const options = {
Expand All @@ -126,37 +157,6 @@ describe.only('test generic binding', () => {
});
});
});

it('should execute queries with bind parameters', () => {
const connectionId = generic.connectUserPassword(connectionParams);
let result = generic.executeQuery(connectionId, 'create or replace table generic_1 (id int, data text);');
assert.deepEqual(result, [['Table GENERIC_1 successfully created.']]);
result = generic.executeQuery(connectionId, 'insert into generic_1 (id, data) values (?, ?)', {
binds: [1, 'test żółć']
});
assert.deepEqual(result, [[1]], 'insert'); // one inserted row
result = generic.executeQuery(connectionId, 'select id, data from generic_1 where id = ?', {
binds: [1]
});
assert.deepEqual(result, [[1, 'test żółć']], 'select after insert');
result = generic.executeQuery(connectionId, 'update generic_1 set data = ? where id = ?', {
binds: ['test 2', 1]
});
assert.deepEqual(result, [[1, 0]], 'update'); // one updated row, 0 number of multi-joined rows updated
result = generic.executeQuery(connectionId, 'select id, data from generic_1 where id = ?', {
binds: [1]
});
assert.deepEqual(result, [[1, 'test 2']], 'select after update');
result = generic.executeQuery(connectionId, 'delete from generic_1 where id = ?', {
binds: [1]
});
assert.deepEqual(result, [[1]], 'delete'); // one deleted row
result = generic.executeQuery(connectionId, 'select id, data from generic_1 where id = ?', {
binds: [1]
});
assert.deepEqual(result, [], 'select after delete');
generic.closeConnection(connectionId);
});
})
;

Expand All @@ -181,7 +181,9 @@ describe.only('Perf selects standard nodejs', () => {
});

[10, 10000, 1000000].forEach(sourceRowCount => {
it(`should select ${sourceRowCount} rows in JSON`, async () => {
const resultFormat = 'JSON';

it(`NODEJS|${sourceRowCount}|${resultFormat}|ROWS`, async () => {
const result = await testUtil.executeCmdAsync(connection,
`select randstr(10, random()) as a
from table (generator(rowcount =>${sourceRowCount}))`,
Expand Down Expand Up @@ -217,7 +219,7 @@ describe.only('Perf selects standard nodejs', () => {
});
};

it(`should select ${sourceRowCount} rows in JSON with streaming`, async () => {
it(`NODEJS|${sourceRowCount}|${resultFormat}|STREAM`, async () => {
const rowLength = await countRows(connection,
`select randstr(10, random()) as a
from table (generator(rowcount =>${sourceRowCount}))`,
Expand Down

0 comments on commit 8ce4d14

Please sign in to comment.