Skip to content

Commit

Permalink
SNOW-743920: Add test fetching many chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz committed Jun 28, 2023
1 parent 4639c98 commit 3811ca1
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions test/integration/testLargeResultSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
const assert = require('assert');
const testUtil = require('./testUtil');

const sourceRowCount = 10000;

describe('Large result Set Tests', function ()
{
const sourceRowCount = 10000;

let connection;
const selectAllFromOrders = `select randstr(1000,random()) from table(generator(rowcount=>${sourceRowCount}))`;

Expand Down Expand Up @@ -106,3 +106,41 @@ describe('Large result Set Tests', function ()
});
});
});

describe('SNOW-743920: Large result set with ~35 chunks', function () {
let connection;
const tableName = 'test_table';
const sourceRowCount = 251002;
const createTable = `create or replace table ${tableName} (data string)`;
const populateData = `insert into ${tableName} select randstr(20, random()) from table (generator(rowcount =>${sourceRowCount}))`;
const selectAllFromOrders = `select * from ${tableName}`;

before(async () => {
connection = testUtil.createConnection();
await testUtil.connectAsync(connection);
await testUtil.executeCmdAsync(connection, 'alter session set ROWS_PER_RESULTSET = 1000000');
await testUtil.executeCmdAsync(connection, 'alter session set USE_CACHED_RESULT = false;');
await testUtil.executeCmdAsync(connection, createTable);
await testUtil.executeCmdAsync(connection, populateData);
});

after(async () => {
await testUtil.dropTablesIgnoringErrorsAsync(connection, [tableName]);
await testUtil.destroyConnectionAsync(connection);
});

it('fetch result set with many chunks', function (done) {
connection.execute({
sqlText: selectAllFromOrders,
complete: function (err, _, rows) {
try {
testUtil.checkError(err);
assert.strictEqual(rows.length, sourceRowCount);
done();
} catch (e) {
done(e);
}
}
});
});
});

0 comments on commit 3811ca1

Please sign in to comment.