summaryrefslogtreecommitdiffstats
path: root/test/test_events.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/test_events.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_events.sh b/test/test_events.sh
new file mode 100644
index 0000000..2266c4b
--- /dev/null
+++ b/test/test_events.sh
@@ -0,0 +1,31 @@
+#! /bin/bash
+
+rm -rf events-home
+mkdir -p events-home
+export HOME=events-home
+export YES_COLOR=1
+
+run_cap_test ${lnav_test} -n \
+ -c ';SELECT json(content) as content FROM lnav_events' \
+ -c ':write-jsonlines-to -' \
+ ${test_dir}/logfile_access_log.0
+
+run_cap_test ${lnav_test} -nN \
+ -c ':config /log/watch-expressions/http-errors/expr sc_status >= 400 AND bad'
+
+run_cap_test ${lnav_test} -nN \
+ -c ':config /log/watch-expressions/http-errors/expr :sc_status >= 400'
+
+run_cap_test env TEST_COMMENT="watch expression generate detect event" ${lnav_test} -n \
+ -c ';SELECT json(content) as content FROM lnav_events' \
+ -c ':write-jsonlines-to -' \
+ ${test_dir}/logfile_access_log.0
+
+run_cap_test env TEST_COMMENT="show the configuration" ${lnav_test} -nN \
+ -c ':config /log/watch-expressions'
+
+run_cap_test env TEST_COMMENT="delete the configuration" ${lnav_test} -nN \
+ -c ':reset-config /log/watch-expressions/http-errors/'
+
+run_cap_test env TEST_COMMENT="config should be gone now" ${lnav_test} -nN \
+ -c ':config /log/watch-expressions'