aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/tst-status.sh
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-09-29 23:44:16 +0500
committerEgor Tensin <egor@tensin.name>2026-09-29 23:45:40 +0500
commiteec673b5c0122e359bf00b0136783a32e8a77df9 (patch)
tree61457ccf0d65331f1411b28aa7ba2ad964191ba2 /test/tst-status.sh
parentremove annoying trailing period from repo URLs (diff)
downloadvk-scripts-eec673b5c0122e359bf00b0136783a32e8a77df9.tar.gz
vk-scripts-eec673b5c0122e359bf00b0136783a32e8a77df9.zip
test: rework using the approach from my other projectsv1.2.0
The tests are now run using a framework common to my other projects, like config-links & tag-release.
Diffstat (limited to 'test/tst-status.sh')
-rw-r--r--test/tst-status.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/tst-status.sh b/test/tst-status.sh
new file mode 100644
index 0000000..e967ae5
--- /dev/null
+++ b/test/tst-status.sh
@@ -0,0 +1,45 @@
+test_run() {
+ test_setup
+
+ local users=(egor.tensin)
+
+ local log_path
+ log_path="$test_root_dir/status.log"
+ local db_path
+ db_path="$test_root_dir/status.csv"
+
+ test_run_module vk.tracking.status \
+ --log "$log_path" \
+ --format csv \
+ --output "$db_path" \
+ "${users[@]}" &
+ local pid="$!"
+
+ sleep 3
+ log "Log file: $log_path"
+ log "Database file: $db_path"
+ log "PID: $pid"
+
+ local timeout=10
+ log "Sleeping for $timeout seconds..."
+ sleep "$timeout"
+
+ log 'Terminating track_status.py...'
+ kill "$pid"
+ log 'Waiting for track_status.py to terminate...'
+ wait "$pid" || true
+
+ if [ ! -s "$log_path" ]; then
+ fail "Log file '$log_path' either doesn't exists or is empty"
+ return 1
+ fi
+ log 'Log file:'
+ cat -- "$log_path" >&2
+
+ if [ ! -s "$db_path" ]; then
+ fail "Database file '$db_path' either doesn't exists or is empty"
+ return 1
+ fi
+ log 'Database:'
+ cat -- "$db_path" >&2
+}