Skip to content

Commit

Permalink
[misc] test improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed May 31, 2023
1 parent a0762e7 commit 1624d5e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
13 changes: 9 additions & 4 deletions test/integration/datatype/test-bit.js
Expand Up @@ -7,10 +7,15 @@ describe('bit type', () => {
it('bit type verification', async () => {
await shareConn.query('DROP TABLE IF EXISTS test_bit');
await shareConn.query('CREATE TABLE test_bit ( val1 bit(1), val2 bit(8))');
await shareConn.query('INSERT INTO test_bit VALUES (?, ?)', [Buffer.from([0x00]), Buffer.from([0x00])]);
await shareConn.query('INSERT INTO test_bit VALUES (?, ?)', [Buffer.from([0x01]), Buffer.from([0x01])]);
await shareConn.query('INSERT INTO test_bit VALUES (?, ?)', [null, null]);

await shareConn.query('INSERT INTO test_bit VALUES (?, ?), (?, ?), (?, ?)', [
Buffer.from([0x00]),
Buffer.from([0x00]),
Buffer.from([0x01]),
Buffer.from([0x01]),
null,
null
]);
await shareConn.query('FLUSH TABLES');
const expected = [
{ val1: false, val2: Buffer.from([0x00]) },
{ val1: true, val2: Buffer.from([0x01]) },
Expand Down
3 changes: 1 addition & 2 deletions test/integration/datatype/test-buffer.js
Expand Up @@ -29,8 +29,7 @@ describe('buffer', () => {
let rows = await shareConn.query(' SELECT ' + shareConn.escape(buf) + ' t');
assert.deepEqual(rows, [{ t: buf }]);

await shareConn.query('INSERT INTO BufEscape VALUE (' + shareConn.escape(buf) + ')');
await shareConn.query('INSERT INTO BufEscape VALUE (?)', buf);
await shareConn.query('INSERT INTO BufEscape VALUE (' + shareConn.escape(buf) + '), (?)', buf);
rows = await shareConn.query('SELECT * FROM BufEscape');
assert.deepEqual(rows, [{ b: buf }, { b: buf }]);
});
Expand Down
3 changes: 2 additions & 1 deletion test/integration/test-debug.js
Expand Up @@ -8,6 +8,7 @@ const path = require('path');
const util = require('util');
const winston = require('winston');
const { isXpand } = require('../base');
const Conf = require('../conf');

describe('debug', () => {
const smallFileName = path.join(os.tmpdir(), 'smallLocalInfileDebug.txt');
Expand Down Expand Up @@ -305,7 +306,7 @@ describe('debug', () => {
setTimeout(() => {
const data = fs.readFileSync(tmpLogFile, 'utf8');
const serverVersion = conn.serverVersion();
const range = [6500, 8400];
const range = [6500, 8400 + (Conf.baseConfig.ssl ? 250 : 0)];
assert(
data.length > range[0] && data.length < range[1],
'wrong data length : ' +
Expand Down
3 changes: 2 additions & 1 deletion test/integration/test-query-values-in-sql.js
Expand Up @@ -149,7 +149,8 @@ describe('sql template strings', () => {
});
});

it('pool query with parameters', (done) => {
it('pool query with parameters', function(done) {
if (process.env.srv === 'maxscale' && process.env.srv === 'skysql-ha') this.skip;
const pool = base.createPool();
pool
.query('drop table IF EXISTS pool_query_param')
Expand Down

0 comments on commit 1624d5e

Please sign in to comment.