Skip to content

Commit

Permalink
fixed integration tests and removed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Sep 19, 2023
1 parent 0268c02 commit 3a619fe
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 37 deletions.
5 changes: 1 addition & 4 deletions lib/queryContextCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,9 @@ QueryContextCache.prototype.deserializeQueryContext = function (data) {
this.clearCache();
}

// After merging all entries, truncate to capacity
this.checkCacheCapacity();

// Log existing cache entries
this.logCacheEntries();
}; // Synchronized
};

QueryContextCache.prototype.deserializeQueryContextElement = function (node) {
const {id, timestamp, priority, context} = node;
Expand Down
63 changes: 30 additions & 33 deletions test/integration/testHTAP.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,50 +45,48 @@ describe('Query Context Cache test', function () {

function createQueryTest () {
const testingSet = [];
let testingfunction;
for(let i = 0; i < querySet.length; i++) {
const testingFunction = function(callback) {
const {sqlTexts,QccSize} = querySet[i];
connection.execute({
sqlText: sqlTexts[0],
complete: function (err) {
if (err) {
callback(err);
}
}
});
connection.execute({
sqlText: sqlTexts[1],
complete: function (err) {
if (err) {
callback(err);
}
}
});
connection.execute({
sqlText: sqlTexts[2],
complete: function (err, stmt) {
assert.ok(!err,'There should be no error!');
assert.strictEqual(stmt.getQueryContextCacheSize(), QccSize);
assert.strictEqual(stmt.getQueryContextDTOSize(),QccSize);
callback();
}
});
};
testingSet.push(testingFunction);
const {sqlTexts,QccSize} = querySet[i];
for(let k = 0; k < sqlTexts.length; k++){
if(k!==sqlTexts.length-1){
testingfunction = function(callback) {
connection.execute({
sqlText: sqlTexts[k],
complete: function () {
callback();
}
});
};
}
else{
testingfunction = function(callback) {
connection.execute({
sqlText: sqlTexts[2],
complete: function (err, stmt) {
assert.ok(!err,'There should be no error!');
assert.strictEqual(stmt.getQueryContextCacheSize(), QccSize);
assert.strictEqual(stmt.getQueryContextDTOSize(), QccSize);
callback();
}
});
};
}
testingSet.push(testingfunction);
}
}
return testingSet;
}

it('test Query Context Cache', function (done) {
let queryTests = createQueryTest();
const queryTests = createQueryTest();
async.series(
[
function (callback) {
connection.connect(function (err, conn) {
assert.ok(!err, 'there should be no error');
assert.strictEqual(conn, connection,
'the connect() callback should be invoked with the statement');

callback();
});
},
Expand All @@ -98,5 +96,4 @@ describe('Query Context Cache test', function () {
done();
});
});

});

0 comments on commit 3a619fe

Please sign in to comment.