Skip to content

Commit

Permalink
added the copy right and reformat the code
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Sep 22, 2023
1 parent 6f0d356 commit 9903f0c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
1 change: 0 additions & 1 deletion lib/connection/connection_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ function ConnectionConfig(options, validateCredentials, qaMode, clientInfo)

let disableQueryContextCache = false;
if (Util.exists(options.disableQueryContextCache)) {

Errors.checkArgumentValid(Util.isBoolean(options.disableQueryContextCache),
ErrorCodes.ERR_CONN_CREATE_INVALID_DISABLED_QUERY_CONTEXT_CACHE);

Expand Down
3 changes: 2 additions & 1 deletion lib/queryContextCache.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2012-2022 Snowflake Computing Inc. All rights reserved.
* Copyright (c) 2023 Snowflake Computing Inc. All rights reserved.
*/

const Logger = require('./logger');

/**
Expand Down
17 changes: 7 additions & 10 deletions test/integration/testHTAP.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2023 Snowflake Computing Inc. All rights reserved.
*/

const assert = require('assert');
const async = require('async');
const connOption = require('./connectionOptions').valid;
Expand All @@ -6,16 +10,11 @@ const testUtil = require('./testUtil');
// Only the AWS servers support the hybrid table in the GitHub action.
if (process.env.CLOUD_PROVIDER === 'AWS') {
describe('Query Context Cache test', function () {
this.timeout(1000000);
let connection;

before((done) => {
before(async () => {
connection = testUtil.createConnection(connOption);
async.series([
function (callback) {
testUtil.connect(connection, callback);
}],
done);
await testUtil.connectAsync(connection);
});

after(async () => {
Expand Down Expand Up @@ -93,9 +92,7 @@ if (process.env.CLOUD_PROVIDER === 'AWS') {
}

it('test Query Context Cache', function (done) {
async.series(createQueryTest(), function () {
done();
});
async.series(createQueryTest(), done);
});
});
}
11 changes: 7 additions & 4 deletions test/unit/query_context_cache_test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2023 Snowflake Computing Inc. All rights reserved.
*/

const QueryContextCache = require('../../lib/queryContextCache.js');
const assert = require('assert');

Expand Down Expand Up @@ -80,7 +84,6 @@ function TestingQCC () {
describe('Query Context Cache Test', function () {
const testingQcc = new TestingQCC();

/** Test for empty cache */
it('test - the cache is empty',function () {
testingQcc.initCache();
assert.strictEqual(testingQcc.qcc.getSize(), 0);
Expand All @@ -105,7 +108,7 @@ describe('Query Context Cache Test', function () {

// Add one more element at the end
const i = MAX_CAPACITY;
const extraQCE = new QueryContextElement(BASE_ID + i, BASE_READ_TIMESTAMP + i, BASE_PRIORITY + i, CONTEXT)
const extraQCE = new QueryContextElement(BASE_ID + i, BASE_READ_TIMESTAMP + i, BASE_PRIORITY + i, CONTEXT);
testingQcc.qcc.merge(extraQCE);
testingQcc.qcc.checkCacheCapacity();

Expand Down Expand Up @@ -134,7 +137,7 @@ describe('Query Context Cache Test', function () {
const updatedID = 3;
const updatedPriority = BASE_PRIORITY + updatedID + 7;
testingQcc.expectedPriority[updatedID] = updatedPriority;
const updatedQCE = new QueryContextElement(BASE_ID + updatedID, BASE_READ_TIMESTAMP + updatedID, testingQcc.expectedPriority[updatedID], CONTEXT)
const updatedQCE = new QueryContextElement(BASE_ID + updatedID, BASE_READ_TIMESTAMP + updatedID, testingQcc.expectedPriority[updatedID], CONTEXT);
testingQcc.qcc.merge(updatedQCE);
testingQcc.qcc.checkCacheCapacity();

Expand Down Expand Up @@ -170,7 +173,7 @@ describe('Query Context Cache Test', function () {

// Add one more element with same priority
const i = 2;
const samePriorityQCE = new QueryContextElement(BASE_ID + i, BASE_READ_TIMESTAMP + i - 10, BASE_PRIORITY + i, CONTEXT)
const samePriorityQCE = new QueryContextElement(BASE_ID + i, BASE_READ_TIMESTAMP + i - 10, BASE_PRIORITY + i, CONTEXT);
testingQcc.qcc.merge(samePriorityQCE);
testingQcc.qcc.checkCacheCapacity();

Expand Down

0 comments on commit 9903f0c

Please sign in to comment.