mirror of
https://github.com/lingble/clickhouse.git
synced 2025-11-22 05:44:53 +00:00
Update test.js
This commit is contained in:
28
test/test.js
28
test/test.js
@@ -297,6 +297,34 @@ describe('session', () => {
|
|||||||
|
|
||||||
clickhouse.sessionId = sessionId;
|
clickhouse.sessionId = sessionId;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('uses session per query', async () => {
|
||||||
|
let tempSessionId = `${Date.now()}`;
|
||||||
|
|
||||||
|
const result = await clickhouse.query(
|
||||||
|
`CREATE TEMPORARY TABLE test_table
|
||||||
|
(_id String, str String)
|
||||||
|
ENGINE=Memory`, {}, {sessionId: tempSessionId}
|
||||||
|
).toPromise();
|
||||||
|
expect(result).to.be.ok();
|
||||||
|
|
||||||
|
const result2 = await clickhouse.query(
|
||||||
|
`SELECT * FROM test_table LIMIT 10`, {}, {sessionId: tempSessionId}
|
||||||
|
).toPromise();
|
||||||
|
expect(result2).to.be.ok();
|
||||||
|
try {
|
||||||
|
await clickhouse.query(
|
||||||
|
`SELECT * FROM test_table LIMIT 10`, {}, {sessionId: `${tempSessionId}_bad`}
|
||||||
|
).toPromise();
|
||||||
|
} catch (error) {
|
||||||
|
expect(error.code).to.be(60);
|
||||||
|
}
|
||||||
|
|
||||||
|
const result3 = await clickhouse.query(
|
||||||
|
`DROP TEMPORARY TABLE test_table`, {}, {sessionId: tempSessionId}
|
||||||
|
).toPromise();
|
||||||
|
expect(result3).to.be.ok();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// You can use all settings from request library (https://github.com/request/request#tlsssl-protocol)
|
// You can use all settings from request library (https://github.com/request/request#tlsssl-protocol)
|
||||||
|
|||||||
Reference in New Issue
Block a user