From fba6877702ebb0f01662c635bb37b37a89513f93 Mon Sep 17 00:00:00 2001 From: menshibin Date: Thu, 26 Sep 2024 00:39:09 +0800 Subject: [PATCH] modify node ci example --- tests/docs-examples-test/node.sh | 1 + tests/docs-examples-test/python.sh | 53 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/tests/docs-examples-test/node.sh b/tests/docs-examples-test/node.sh index 0d829c04a4..cbbbd3820e 100644 --- a/tests/docs-examples-test/node.sh +++ b/tests/docs-examples-test/node.sh @@ -58,6 +58,7 @@ node sql_example.js node stmt_example.js + node tmq_example.js node tmq_seek_example.js \ No newline at end of file diff --git a/tests/docs-examples-test/python.sh b/tests/docs-examples-test/python.sh index 5ee16c7899..ed44171f85 100644 --- a/tests/docs-examples-test/python.sh +++ b/tests/docs-examples-test/python.sh @@ -2,6 +2,34 @@ set -e +check_transactions() { + for i in {1..30} + do + output=$(taos -s "show transactions;") + if [[ $output == *"Query OK, 0 row(s)"* ]]; then + echo "Success: No transactions are in progress." + return 0 + fi + sleep 1 + done + + echo "Error: Transactions are still in progress after 30 attempts." + return 1 +} + +reset_cache() { + response=$(curl --location -uroot:taosdata 'http://127.0.0.1:6041/rest/sql' --data 'reset query cache') + + if [[ $response == \{\"code\":0* ]]; then + echo "Success: Query cache reset successfully." + else + echo "Error: Failed to reset query cache. Response: $response" + return 1 + fi +} + + + taosd >>/dev/null 2>&1 & taosadapter >>/dev/null 2>&1 & @@ -11,18 +39,26 @@ cd ../../docs/examples/python # 1 taos -s "create database if not exists log" +check_transactions || exit 1 +reset_cache || exit 1 python3 connect_example.py # 2 taos -s "drop database if exists power" +check_transactions || exit 1 +reset_cache || exit 1 python3 native_insert_example.py # 3 taos -s "drop database power" +check_transactions || exit 1 +reset_cache || exit 1 python3 bind_param_example.py # 4 taos -s "drop database power" +check_transactions || exit 1 +reset_cache || exit 1 python3 multi_bind_example.py # 5 @@ -33,20 +69,28 @@ python3 async_query_example.py # 7 taos -s "drop database if exists test" +check_transactions || exit 1 +reset_cache || exit 1 python3 line_protocol_example.py # 8 taos -s "drop database test" +check_transactions || exit 1 +reset_cache || exit 1 python3 telnet_line_protocol_example.py # 9 taos -s "drop database test" +check_transactions || exit 1 +reset_cache || exit 1 python3 json_protocol_example.py # 10 pip install SQLAlchemy pip install pandas taosBenchmark -y -d power -t 10 -n 10 +check_transactions || exit 1 +reset_cache || exit 1 python3 conn_native_pandas.py python3 conn_rest_pandas.py taos -s "drop database if exists power" @@ -119,10 +163,19 @@ python3 reqid_rest.py python3 reqid_ws.py +taos -s "drop database test" +check_transactions || exit 1 +reset_cache || exit 1 python3 schemaless_native.py +taos -s "drop database test" +check_transactions || exit 1 +reset_cache || exit 1 python3 schemaless_ws.py +taos -s "drop database test" +check_transactions || exit 1 +reset_cache || exit 1 python3 stmt_native.py python3 stmt_ws.py