TDengine/tests/docs-examples-test/node.sh

64 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/bash
set -e
2024-09-25 13:07:10 +00:00
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
}
pgrep taosd || taosd >> /dev/null 2>&1 &
pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
2024-09-25 07:29:34 +00:00
sleep 10
cd ../../docs/examples/node
npm install
2024-09-24 13:04:29 +00:00
cd websocketexample
2024-09-24 07:48:08 +00:00
node all_type_query.js
2024-09-24 07:48:08 +00:00
node all_type_stmt.js
2024-09-25 10:40:08 +00:00
taos -s "drop database if exists power"
2024-09-25 13:07:10 +00:00
check_transactions || exit 1
reset_cache || exit 1
2024-09-24 07:48:08 +00:00
node line_example.js
2024-09-25 13:07:10 +00:00
taos -s "drop database if exists power"
check_transactions || exit 1
reset_cache || exit 1
2024-09-24 07:48:08 +00:00
node nodejsChecker.js
2024-09-24 07:48:08 +00:00
node sql_example.js
2024-09-24 07:48:08 +00:00
node stmt_example.js
2024-09-25 16:39:09 +00:00
2024-09-24 07:48:08 +00:00
node tmq_example.js
2024-09-24 07:48:08 +00:00
node tmq_seek_example.js