add nodejs python ci examples
This commit is contained in:
parent
c0204e3252
commit
c1a19ae0f4
|
@ -34,6 +34,7 @@ async function json_tag_example() {
|
|||
|
||||
} catch (err) {
|
||||
console.error(`Failed to create database example_json_tag or stable stb, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
throw err;
|
||||
} finally {
|
||||
if (wsSql) {
|
||||
await wsSql.close();
|
||||
|
@ -78,9 +79,10 @@ async function all_type_example() {
|
|||
let row = wsRows.getData();
|
||||
console.log(row);
|
||||
}
|
||||
|
||||
|
||||
} catch (err) {
|
||||
console.error(`Failed to create database all_type_example or stable stb, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
throw err;
|
||||
} finally {
|
||||
if (wsSql) {
|
||||
await wsSql.close();
|
||||
|
@ -90,8 +92,13 @@ async function all_type_example() {
|
|||
}
|
||||
|
||||
async function test() {
|
||||
await json_tag_example()
|
||||
await all_type_example()
|
||||
try {
|
||||
await json_tag_example()
|
||||
await all_type_example()
|
||||
} catch (err) {
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
taos.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ async function json_tag_example() {
|
|||
|
||||
} catch (err) {
|
||||
console.error(`Failed to create database example_json_tag or stable stb, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
throw err
|
||||
} finally {
|
||||
if (wsSql) {
|
||||
await wsSql.close();
|
||||
|
@ -125,6 +126,7 @@ async function all_type_example() {
|
|||
|
||||
} catch (err) {
|
||||
console.error(`Failed to create database all_type_example or stable stb, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
throw err;
|
||||
} finally {
|
||||
if (stmt) {
|
||||
await stmt.close();
|
||||
|
@ -139,10 +141,15 @@ async function all_type_example() {
|
|||
|
||||
|
||||
async function test() {
|
||||
taos.setLevel("debug")
|
||||
await json_tag_example()
|
||||
await all_type_example()
|
||||
taos.destroy();
|
||||
try {
|
||||
taos.setLevel("debug")
|
||||
await json_tag_example()
|
||||
await all_type_example()
|
||||
taos.destroy();
|
||||
} catch(e) {
|
||||
process.exitCode = 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
test()
|
||||
|
|
|
@ -38,6 +38,7 @@ async function test() {
|
|||
}
|
||||
catch (err) {
|
||||
console.error(err.code, err.message);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
finally {
|
||||
if (wsRows) {
|
||||
|
|
|
@ -29,6 +29,7 @@ async function test() {
|
|||
}
|
||||
catch (err) {
|
||||
console.error(`Failed to insert data with schemaless, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
finally {
|
||||
if (wsRows) {
|
||||
|
|
|
@ -11,7 +11,7 @@ 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);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,6 +62,7 @@ async function test() {
|
|||
}
|
||||
catch (err) {
|
||||
console.error(err.code, err.message);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
finally {
|
||||
if (wsRows) {
|
||||
|
|
|
@ -41,6 +41,7 @@ async function createDbAndTable() {
|
|||
console.log("Create stable power.meters successfully");
|
||||
} catch (err) {
|
||||
console.error(`Failed to create database power or stable meters, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
throw err;
|
||||
} finally {
|
||||
if (wsSql) {
|
||||
await wsSql.close();
|
||||
|
@ -68,6 +69,7 @@ async function insertData() {
|
|||
console.log("Successfully inserted " + taosResult.getAffectRows() + " rows to power.meters.");
|
||||
} catch (err) {
|
||||
console.error(`Failed to insert data to power.meters, sql: ${insertQuery}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
throw err;
|
||||
} finally {
|
||||
if (wsSql) {
|
||||
await wsSql.close();
|
||||
|
@ -91,6 +93,7 @@ async function queryData() {
|
|||
}
|
||||
catch (err) {
|
||||
console.error(`Failed to query data from power.meters, sql: ${sql}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
throw err;
|
||||
}
|
||||
finally {
|
||||
if (wsRows) {
|
||||
|
@ -118,6 +121,7 @@ async function sqlWithReqid() {
|
|||
}
|
||||
catch (err) {
|
||||
console.error(`Failed to query data from power.meters, reqId: ${reqId}, ErrCode: ${err.code}, ErrMessage: ${err.message}`);
|
||||
throw err;
|
||||
}
|
||||
finally {
|
||||
if (wsRows) {
|
||||
|
@ -131,11 +135,16 @@ async function sqlWithReqid() {
|
|||
// ANCHOR_END: sqlWithReqid
|
||||
|
||||
async function test() {
|
||||
await createDbAndTable();
|
||||
await insertData();
|
||||
await queryData();
|
||||
await sqlWithReqid();
|
||||
taos.destroy();
|
||||
try {
|
||||
await createDbAndTable();
|
||||
await insertData();
|
||||
await queryData();
|
||||
await sqlWithReqid();
|
||||
taos.destroy();
|
||||
} catch(e) {
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
test()
|
||||
|
|
|
@ -60,6 +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;
|
||||
}
|
||||
finally {
|
||||
if (stmt) {
|
||||
|
|
|
@ -11,7 +11,7 @@ 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);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let dbData = ["meters.current 1648432611249 10.3 location=California.SanFrancisco groupid=2",
|
||||
|
@ -44,6 +44,7 @@ async function test() {
|
|||
}
|
||||
catch (err) {
|
||||
console.error(err.code, err.message);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
finally {
|
||||
if (wsRows) {
|
||||
|
|
|
@ -89,6 +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;
|
||||
}
|
||||
finally {
|
||||
if (consumer) {
|
||||
|
|
|
@ -89,6 +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;
|
||||
}
|
||||
finally {
|
||||
if (consumer) {
|
||||
|
|
|
@ -4,7 +4,7 @@ def create_connection():
|
|||
# all parameters are optional.
|
||||
conn = None
|
||||
host = "localhost"
|
||||
port = 6030
|
||||
port = 6031
|
||||
try:
|
||||
conn = taos.connect(
|
||||
user="root",
|
||||
|
@ -15,6 +15,7 @@ def create_connection():
|
|||
print(f"Connected to {host}:{port} successfully.");
|
||||
except Exception as err:
|
||||
print(f"Failed to connect to {host}:{port} , ErrMessage:{err}")
|
||||
raise err
|
||||
finally:
|
||||
if conn:
|
||||
conn.close()
|
||||
|
|
Loading…
Reference in New Issue