Skip to content

Commit

Permalink
SNOW-930831: Add randomization to the table name in put/get test
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pmotacki committed Oct 4, 2023
1 parent 39abad3 commit e317338
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/integration/testPutGet.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ const tmp = require('tmp');
const os = require('os');
const path = require('path');
const zlib = require('zlib');
const {randomizeName} = require("./testUtil");

const DATABASE_NAME = connOption.valid.database;
const SCHEMA_NAME = connOption.valid.schema;
const TEMP_TABLE_NAME = 'TEMP_TABLE';
const TEMP_TABLE_NAME = randomizeName('TEMP_TABLE');

const SKIPPED = 'SKIPPED';
const UPLOADED = 'UPLOADED';
Expand Down
12 changes: 12 additions & 0 deletions test/integration/testUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const snowflake = require('./../../lib/snowflake');
const connOptions = require('./connectionOptions');
const assert = require('assert');
const fs = require('fs');
const crypto = require('crypto');

module.exports.createConnection = function (validConnectionOptionsOverride = {}) {
return snowflake.createConnection({
Expand Down Expand Up @@ -244,3 +245,14 @@ module.exports.deleteFolderSyncIgnoringErrors = function (directory) {
console.warn(`Cannot delete folder ${directory}: ${JSON.stringify(e)}`);
}
};

/**
* @param name string
*/
module.exports.randomizeName = function (name) {
if (name === null || name.trim() === '') {
throw new Error('Name must be non empty string');
}
const randomString = crypto.randomBytes(4).toString('hex');
return name.concat(randomString);
};

0 comments on commit e317338

Please sign in to comment.