diff --git a/lib/connection/statement.js b/lib/connection/statement.js index 980b402d1..130d6bc30 100644 --- a/lib/connection/statement.js +++ b/lib/connection/statement.js @@ -397,35 +397,14 @@ function createContextPreExec( Errors.assertInternal(Util.isObject(services)); Errors.assertInternal(Util.isObject(connectionConfig)); - // if we're not in qa mode, use a random uuid for the statement request id - // or use request id passed by user - if (!connectionConfig.isQaMode()) - { - if (statementOptions.requestId) - { - statementContext.requestId = statementOptions.requestId; - statementContext.resubmitRequest = true; - } - else - { - statementContext.requestId = uuidv4(); - } + // use request id passed by user + if (statementOptions.requestId) { + statementContext.requestId = statementOptions.requestId; + statementContext.resubmitRequest = true; } - else // we're in qa mode - { - // if a request id or sequence id are specified in the statement options, - // use them as is; this is to facilitate testing by making things more - // deterministic - if (Util.isString(statementOptions.requestId)) - { - statementContext.requestId = statementOptions.requestId; - } - - // SNOW-728803: In QA mode, set resubmitRequest to true to test that sqlText - // is not overwritten if a sqlText is already specified by the user - if (statementOptions.requestId === 'SNOW-728803-requestId') { - statementContext.resubmitRequest = true; - } + else { + // use a random uuid for the statement request id + statementContext.requestId = uuidv4(); } return statementContext; diff --git a/test/unit/mock/mock_http_client.js b/test/unit/mock/mock_http_client.js index 579d58f68..0f9e7c5bc 100644 --- a/test/unit/mock/mock_http_client.js +++ b/test/unit/mock/mock_http_client.js @@ -704,7 +704,7 @@ function buildRequestOutputMappings(clientInfo) request: { method: 'POST', - url: 'http://fakeaccount.snowflakecomputing.com/queries/v1/query-request?requestId=', + url: 'http://fakeaccount.snowflakecomputing.com/queries/v1/query-request?requestId=SNOW-728803-requestId', headers: { 'Accept': 'application/snowflake', @@ -723,14 +723,21 @@ function buildRequestOutputMappings(clientInfo) err: null, response: { - statusCode: 401, - statusMessage: 'Unauthorized', + statusCode: 200, + statusMessage: 'OK', body: { - 'data' : null, - 'code': '390103', - 'message': 'Session token not found in the request data.', - 'success': false, + 'data': + { + 'parameters': [], + 'rowtype': [], + 'rowset': [['1']], + 'total': 1, + 'returned': 1 + }, + 'message': null, + 'code': null, + 'success': true } } } @@ -766,48 +773,6 @@ function buildRequestOutputMappings(clientInfo) } } }, - { - request: - { - method: 'POST', - url: 'http://fakeaccount.snowflakecomputing.com/queries/v1/query-request?requestId=SNOW-728803-requestId', - headers: - { - 'Accept': 'application/snowflake', - 'Authorization': 'Snowflake Token="SESSION_TOKEN"', - 'Content-Type': 'application/json' - }, - json: - { - disableOfflineChunks: false, - sqlText: 'select 1;', - queryContextDTO: { entries: [] } - } - }, - output: - { - err: null, - response: - { - statusCode: 200, - statusMessage: 'OK', - body: - { - 'data': - { - 'parameters': [], - 'rowtype': [], - 'rowset': [['1']], - 'total': 1, - 'returned': 1 - }, - 'message': null, - 'code': null, - 'success': true - } - } - } - }, { request: { diff --git a/test/unit/snowflake_test.js b/test/unit/snowflake_test.js index 06edd2422..29c02410d 100644 --- a/test/unit/snowflake_test.js +++ b/test/unit/snowflake_test.js @@ -956,21 +956,7 @@ describe('connection.execute() with requestId', function () { }); }, function (callback) { - // 1st request fails with an error - statement = connection.execute( - { - sqlText: sqlText, - complete: function (err, stmt) { - assert.ok(err, 'there should be an error'); - assert.strictEqual(stmt, statement, - 'the execute() callback should be invoked with the statement'); - - callback(); - } - }); - }, - function (callback) { - // 2nd request with sqlText and requestId specified + // request with sqlText and requestId specified statement = connection.execute( { sqlText: sqlText,