modify node ci example

This commit is contained in:
menshibin 2024-09-25 15:29:34 +08:00
parent 5ac9c59dee
commit 63d62fdfd3
12 changed files with 65 additions and 48 deletions

View File

@ -92,13 +92,8 @@ async function all_type_example() {
}
async function test() {
try {
await json_tag_example()
await all_type_example()
} catch (err) {
process.exitCode = 1;
}
taos.destroy();
}

View File

@ -138,18 +138,10 @@ async function all_type_example() {
}
async function test() {
try {
taos.setLevel("debug")
await json_tag_example()
await all_type_example()
taos.destroy();
} catch(e) {
process.exitCode = 1
}
}
test()

View File

@ -10,9 +10,8 @@ for(var i = 2; i < global.process.argv.length; i++){
}
if(host == null){
console.log("Usage: node nodejsChecker.js host=<hostname> port=<port>");
process.exit(0);
}
host = 'localhost'
}
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\"}}",
@ -27,7 +26,7 @@ async function createConnect() {
return await taos.sqlConnect(conf);
}
async function test() {
async function schemalessInsert() {
let wsSql = null;
let wsRows = null;
let reqId = 0;
@ -38,7 +37,7 @@ async function test() {
}
catch (err) {
console.error(err.code, err.message);
process.exitCode = 1;
throw err
}
finally {
if (wsRows) {
@ -51,4 +50,8 @@ async function test() {
}
}
async function test() {
await schemalessInsert();
}
test()

View File

@ -15,7 +15,8 @@ async function createConnect() {
return wsSql;
}
async function test() {
async function schemalessInsert() {
let wsSql = null;
let wsRows = null;
let ttl = 0;
@ -28,7 +29,7 @@ async function test() {
}
catch (err) {
console.error(`Failed to insert data with schemaless, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
process.exitCode = 1;
throw err;
}
finally {
if (wsRows) {
@ -40,4 +41,9 @@ async function test() {
taos.destroy();
}
}
async function test() {
await schemalessInsert();
}
test()

View File

@ -22,7 +22,7 @@ async function createConnect() {
return await taos.sqlConnect(conf);
}
async function test() {
async function execSql() {
let wsSql = null;
let wsRows = null;
let reqId = 0;
@ -73,4 +73,8 @@ async function test() {
}
}
async function test() {
await execSql();
}
test()

View File

@ -136,16 +136,11 @@ async function sqlWithReqid() {
// ANCHOR_END: sqlWithReqid
async function test() {
try {
await createDbAndTable();
await insertData();
await queryData();
await sqlWithReqid();
taos.destroy();
} catch(e) {
process.exitCode = 1;
}
}
test()

View File

@ -23,7 +23,7 @@ async function prepare() {
return wsSql
}
(async () => {
async function stmtInsert() {
let stmt = null;
let connector = null;
try {
@ -60,7 +60,7 @@ async function prepare() {
}
catch (err) {
console.error(`Failed to insert to table meters using stmt, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
process.exitCode = 1;
throw err;
}
finally {
if (stmt) {
@ -71,4 +71,10 @@ async function prepare() {
}
taos.destroy();
}
})();
}
async function test () {
await stmtInsert();
}
test()

View File

@ -32,7 +32,7 @@ async function createConnect() {
return await taos.sqlConnect(conf);
}
async function test() {
async function schemalessInsert() {
let wsSql = null;
let wsRows = null;
let reqId = 0;
@ -56,4 +56,9 @@ async function test() {
taos.destroy();
}
}
test()
async function test() {
await schemalessInsert();
}
test()

View File

@ -77,7 +77,7 @@ async function subscribe(consumer) {
// ANCHOR_END: commit
}
async function test() {
async function consumer() {
// ANCHOR: unsubscribe
let consumer = null;
try {
@ -89,7 +89,7 @@ async function test() {
}
catch (err) {
console.error(`Failed to unsubscribe consumer, topic: ${topic}, groupId: ${groupId}, clientId: ${clientId}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
process.exitCode = 1;
throw err;
}
finally {
if (consumer) {
@ -101,4 +101,8 @@ async function test() {
// ANCHOR_END: unsubscribe
}
async function test() {
await consumer();
}
test()

View File

@ -72,7 +72,7 @@ async function subscribe(consumer) {
// ANCHOR_END: subscribe
// ANCHOR: offset
async function test() {
async function consumer() {
let consumer = null;
try {
await prepare();
@ -89,7 +89,7 @@ async function test() {
}
catch (err) {
console.error(`Failed to seek offset, topic: ${topic}, groupId: ${groupId}, clientId: ${clientId}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
process.exitCode = 1;
throw err;
}
finally {
if (consumer) {
@ -99,4 +99,9 @@ async function test() {
}
}
// ANCHOR_END: offset
async function test() {
await consumer();
}
test()

View File

@ -5,6 +5,8 @@ set -e
pgrep taosd || taosd >> /dev/null 2>&1 &
pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
sleep 10
cd ../../docs/examples/node
npm install

View File

@ -86,7 +86,7 @@ pip3 install kafka-python
python3 kafka_example_consumer.py
# 21
pip3 install taos-ws-py==0.3.1
pip3 install taos-ws-py==0.3.3
python3 conn_websocket_pandas.py
# 22