modify node ci example
This commit is contained in:
parent
5ac9c59dee
commit
63d62fdfd3
|
@ -92,13 +92,8 @@ async function all_type_example() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function test() {
|
async function test() {
|
||||||
try {
|
await json_tag_example()
|
||||||
await json_tag_example()
|
await all_type_example()
|
||||||
await all_type_example()
|
|
||||||
} catch (err) {
|
|
||||||
process.exitCode = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
taos.destroy();
|
taos.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,18 +138,10 @@ async function all_type_example() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function test() {
|
||||||
|
await json_tag_example()
|
||||||
async function test() {
|
await all_type_example()
|
||||||
try {
|
taos.destroy();
|
||||||
taos.setLevel("debug")
|
|
||||||
await json_tag_example()
|
|
||||||
await all_type_example()
|
|
||||||
taos.destroy();
|
|
||||||
} catch(e) {
|
|
||||||
process.exitCode = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test()
|
test()
|
||||||
|
|
|
@ -10,9 +10,8 @@ for(var i = 2; i < global.process.argv.length; i++){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(host == null){
|
if(host == null){
|
||||||
console.log("Usage: node nodejsChecker.js host=<hostname> port=<port>");
|
host = 'localhost'
|
||||||
process.exit(0);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let dbData = ["{\"metric\": \"meter_current\",\"timestamp\": 1626846402,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"California.SanFrancisco\", \"id\": \"d1001\"}}",
|
let dbData = ["{\"metric\": \"meter_current\",\"timestamp\": 1626846402,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"California.SanFrancisco\", \"id\": \"d1001\"}}",
|
||||||
"{\"metric\": \"meter_current\",\"timestamp\": 1626846403,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"California.SanFrancisco\", \"id\": \"d1002\"}}",
|
"{\"metric\": \"meter_current\",\"timestamp\": 1626846403,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"California.SanFrancisco\", \"id\": \"d1002\"}}",
|
||||||
|
@ -27,7 +26,7 @@ async function createConnect() {
|
||||||
return await taos.sqlConnect(conf);
|
return await taos.sqlConnect(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function test() {
|
async function schemalessInsert() {
|
||||||
let wsSql = null;
|
let wsSql = null;
|
||||||
let wsRows = null;
|
let wsRows = null;
|
||||||
let reqId = 0;
|
let reqId = 0;
|
||||||
|
@ -38,7 +37,7 @@ async function test() {
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err.code, err.message);
|
console.error(err.code, err.message);
|
||||||
process.exitCode = 1;
|
throw err
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (wsRows) {
|
if (wsRows) {
|
||||||
|
@ -51,4 +50,8 @@ async function test() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function test() {
|
||||||
|
await schemalessInsert();
|
||||||
|
}
|
||||||
|
|
||||||
test()
|
test()
|
|
@ -15,7 +15,8 @@ async function createConnect() {
|
||||||
return wsSql;
|
return wsSql;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function test() {
|
|
||||||
|
async function schemalessInsert() {
|
||||||
let wsSql = null;
|
let wsSql = null;
|
||||||
let wsRows = null;
|
let wsRows = null;
|
||||||
let ttl = 0;
|
let ttl = 0;
|
||||||
|
@ -28,7 +29,7 @@ async function test() {
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(`Failed to insert data with schemaless, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
console.error(`Failed to insert data with schemaless, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||||
process.exitCode = 1;
|
throw err;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (wsRows) {
|
if (wsRows) {
|
||||||
|
@ -40,4 +41,9 @@ async function test() {
|
||||||
taos.destroy();
|
taos.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function test() {
|
||||||
|
await schemalessInsert();
|
||||||
|
}
|
||||||
|
|
||||||
test()
|
test()
|
||||||
|
|
|
@ -22,7 +22,7 @@ async function createConnect() {
|
||||||
return await taos.sqlConnect(conf);
|
return await taos.sqlConnect(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function test() {
|
async function execSql() {
|
||||||
let wsSql = null;
|
let wsSql = null;
|
||||||
let wsRows = null;
|
let wsRows = null;
|
||||||
let reqId = 0;
|
let reqId = 0;
|
||||||
|
@ -73,4 +73,8 @@ async function test() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function test() {
|
||||||
|
await execSql();
|
||||||
|
}
|
||||||
|
|
||||||
test()
|
test()
|
|
@ -63,7 +63,7 @@ async function insertData() {
|
||||||
"power.d1002 USING power.meters TAGS('California.SanFrancisco', 3) " +
|
"power.d1002 USING power.meters TAGS('California.SanFrancisco', 3) " +
|
||||||
"VALUES " +
|
"VALUES " +
|
||||||
"(NOW + 1a, 10.30000, 218, 0.25000) ";
|
"(NOW + 1a, 10.30000, 218, 0.25000) ";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
wsSql = await createConnect();
|
wsSql = await createConnect();
|
||||||
taosResult = await wsSql.exec(insertQuery);
|
taosResult = await wsSql.exec(insertQuery);
|
||||||
|
@ -136,16 +136,11 @@ async function sqlWithReqid() {
|
||||||
// ANCHOR_END: sqlWithReqid
|
// ANCHOR_END: sqlWithReqid
|
||||||
|
|
||||||
async function test() {
|
async function test() {
|
||||||
try {
|
await createDbAndTable();
|
||||||
await createDbAndTable();
|
await insertData();
|
||||||
await insertData();
|
await queryData();
|
||||||
await queryData();
|
await sqlWithReqid();
|
||||||
await sqlWithReqid();
|
taos.destroy();
|
||||||
taos.destroy();
|
|
||||||
} catch(e) {
|
|
||||||
process.exitCode = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test()
|
test()
|
||||||
|
|
|
@ -23,7 +23,7 @@ async function prepare() {
|
||||||
return wsSql
|
return wsSql
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
async function stmtInsert() {
|
||||||
let stmt = null;
|
let stmt = null;
|
||||||
let connector = null;
|
let connector = null;
|
||||||
try {
|
try {
|
||||||
|
@ -60,7 +60,7 @@ async function prepare() {
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(`Failed to insert to table meters using stmt, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
console.error(`Failed to insert to table meters using stmt, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||||
process.exitCode = 1;
|
throw err;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (stmt) {
|
if (stmt) {
|
||||||
|
@ -71,4 +71,10 @@ async function prepare() {
|
||||||
}
|
}
|
||||||
taos.destroy();
|
taos.destroy();
|
||||||
}
|
}
|
||||||
})();
|
}
|
||||||
|
|
||||||
|
async function test () {
|
||||||
|
await stmtInsert();
|
||||||
|
}
|
||||||
|
|
||||||
|
test()
|
|
@ -32,7 +32,7 @@ async function createConnect() {
|
||||||
return await taos.sqlConnect(conf);
|
return await taos.sqlConnect(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function test() {
|
async function schemalessInsert() {
|
||||||
let wsSql = null;
|
let wsSql = null;
|
||||||
let wsRows = null;
|
let wsRows = null;
|
||||||
let reqId = 0;
|
let reqId = 0;
|
||||||
|
@ -56,4 +56,9 @@ async function test() {
|
||||||
taos.destroy();
|
taos.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
test()
|
|
||||||
|
async function test() {
|
||||||
|
await schemalessInsert();
|
||||||
|
}
|
||||||
|
|
||||||
|
test()
|
|
@ -77,7 +77,7 @@ async function subscribe(consumer) {
|
||||||
// ANCHOR_END: commit
|
// ANCHOR_END: commit
|
||||||
}
|
}
|
||||||
|
|
||||||
async function test() {
|
async function consumer() {
|
||||||
// ANCHOR: unsubscribe
|
// ANCHOR: unsubscribe
|
||||||
let consumer = null;
|
let consumer = null;
|
||||||
try {
|
try {
|
||||||
|
@ -89,7 +89,7 @@ async function test() {
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(`Failed to unsubscribe consumer, topic: ${topic}, groupId: ${groupId}, clientId: ${clientId}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
console.error(`Failed to unsubscribe consumer, topic: ${topic}, groupId: ${groupId}, clientId: ${clientId}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||||
process.exitCode = 1;
|
throw err;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (consumer) {
|
if (consumer) {
|
||||||
|
@ -101,4 +101,8 @@ async function test() {
|
||||||
// ANCHOR_END: unsubscribe
|
// ANCHOR_END: unsubscribe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function test() {
|
||||||
|
await consumer();
|
||||||
|
}
|
||||||
|
|
||||||
test()
|
test()
|
||||||
|
|
|
@ -72,7 +72,7 @@ async function subscribe(consumer) {
|
||||||
// ANCHOR_END: subscribe
|
// ANCHOR_END: subscribe
|
||||||
|
|
||||||
// ANCHOR: offset
|
// ANCHOR: offset
|
||||||
async function test() {
|
async function consumer() {
|
||||||
let consumer = null;
|
let consumer = null;
|
||||||
try {
|
try {
|
||||||
await prepare();
|
await prepare();
|
||||||
|
@ -89,7 +89,7 @@ async function test() {
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(`Failed to seek offset, topic: ${topic}, groupId: ${groupId}, clientId: ${clientId}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
console.error(`Failed to seek offset, topic: ${topic}, groupId: ${groupId}, clientId: ${clientId}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||||
process.exitCode = 1;
|
throw err;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (consumer) {
|
if (consumer) {
|
||||||
|
@ -99,4 +99,9 @@ async function test() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ANCHOR_END: offset
|
// ANCHOR_END: offset
|
||||||
|
|
||||||
|
async function test() {
|
||||||
|
await consumer();
|
||||||
|
}
|
||||||
|
|
||||||
test()
|
test()
|
||||||
|
|
|
@ -5,6 +5,8 @@ set -e
|
||||||
pgrep taosd || taosd >> /dev/null 2>&1 &
|
pgrep taosd || taosd >> /dev/null 2>&1 &
|
||||||
pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
|
pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
|
||||||
cd ../../docs/examples/node
|
cd ../../docs/examples/node
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
|
|
|
@ -86,7 +86,7 @@ pip3 install kafka-python
|
||||||
python3 kafka_example_consumer.py
|
python3 kafka_example_consumer.py
|
||||||
|
|
||||||
# 21
|
# 21
|
||||||
pip3 install taos-ws-py==0.3.1
|
pip3 install taos-ws-py==0.3.3
|
||||||
python3 conn_websocket_pandas.py
|
python3 conn_websocket_pandas.py
|
||||||
|
|
||||||
# 22
|
# 22
|
||||||
|
|
Loading…
Reference in New Issue