From fbf3fc371a36aded0525cddcc5f49aead64b48b9 Mon Sep 17 00:00:00 2001 From: Dominik Lohmann Date: Wed, 22 Jan 2025 09:33:05 +0100 Subject: [PATCH 1/2] Adjust to upstream changes in BATS setup --- .dockerignore | 2 +- Dockerfile | 2 +- README.md | 2 +- {integration => bats}/data/inputs/sample.log | 0 .../data/reference/tests/test_parse_example_logs/step_00.ref | 0 .../tests/test_parse_example_logs_with_argument/step_00.ref | 0 {integration => bats}/tests/setup_suite.bash | 2 +- {integration => bats}/tests/tests.bats | 0 docker-compose.yaml | 2 +- 9 files changed, 5 insertions(+), 5 deletions(-) rename {integration => bats}/data/inputs/sample.log (100%) rename {integration => bats}/data/reference/tests/test_parse_example_logs/step_00.ref (100%) rename {integration => bats}/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref (100%) rename {integration => bats}/tests/setup_suite.bash (86%) rename {integration => bats}/tests/tests.bats (100%) diff --git a/.dockerignore b/.dockerignore index 1a60add..a28c4a1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,4 @@ /LICENSE /README.md /docker-compose.yaml -/integration/data/reference/ +/bats/data/reference/ diff --git a/Dockerfile b/Dockerfile index 860ca7a..d6770fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN cmake --install /tmp/example/build --strip --component Runtime --prefix /tmp FROM builder AS test -ENTRYPOINT cmake --build /tmp/example/build --target update-integration +ENTRYPOINT cmake --build /tmp/example/build --target update-bats FROM ghcr.io/tenzir/tenzir:${TENZIR_VERSION} diff --git a/README.md b/README.md index 4950161..79601a1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ We think that learning how to build a plugin is best done by example. This example plugin implements a simple operator `read_custom_log` that parses a -[custom line-based log format](integration/data/inputs/sample.log). +[custom line-based log format](bats/data/inputs/sample.log). The operators C++ implementation can be found in [`builtins/operators/read_custom_log.cpp`](builtins/operators/read_custom_log.cpp) diff --git a/integration/data/inputs/sample.log b/bats/data/inputs/sample.log similarity index 100% rename from integration/data/inputs/sample.log rename to bats/data/inputs/sample.log diff --git a/integration/data/reference/tests/test_parse_example_logs/step_00.ref b/bats/data/reference/tests/test_parse_example_logs/step_00.ref similarity index 100% rename from integration/data/reference/tests/test_parse_example_logs/step_00.ref rename to bats/data/reference/tests/test_parse_example_logs/step_00.ref diff --git a/integration/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref b/bats/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref similarity index 100% rename from integration/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref rename to bats/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref diff --git a/integration/tests/setup_suite.bash b/bats/tests/setup_suite.bash similarity index 86% rename from integration/tests/setup_suite.bash rename to bats/tests/setup_suite.bash index 9769d95..da29851 100644 --- a/integration/tests/setup_suite.bash +++ b/bats/tests/setup_suite.bash @@ -5,4 +5,4 @@ setup_suite() { export_default_paths } -export BATS_LIB_PATH=${BATS_LIB_PATH:+${BATS_LIB_PATH}:}/tmp/tenzir/tenzir/integration/lib +export BATS_LIB_PATH=${BATS_LIB_PATH:+${BATS_LIB_PATH}:}/tmp/tenzir/tenzir/bats/lib diff --git a/integration/tests/tests.bats b/bats/tests/tests.bats similarity index 100% rename from integration/tests/tests.bats rename to bats/tests/tests.bats diff --git a/docker-compose.yaml b/docker-compose.yaml index b85900c..34e5d21 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -42,7 +42,7 @@ services: profiles: - donotstart volumes: - - ./integration/data/reference/:/tmp/example/integration/data/reference/ + - ./bats/data/reference/:/tmp/example/bats/data/reference/ volumes: tenzir-lib: From c860e7cd71bd1b103d33de3f6fa90e140f841fff Mon Sep 17 00:00:00 2001 From: Dominik Lohmann Date: Wed, 19 Feb 2025 11:05:36 +0100 Subject: [PATCH 2/2] Update integration test references to TQL format --- .../tests/test_parse_example_logs/step_00.ref | 10 +++++----- .../test_parse_example_logs_with_argument/step_00.ref | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bats/data/reference/tests/test_parse_example_logs/step_00.ref b/bats/data/reference/tests/test_parse_example_logs/step_00.ref index 765dc29..1336d84 100644 --- a/bats/data/reference/tests/test_parse_example_logs/step_00.ref +++ b/bats/data/reference/tests/test_parse_example_logs/step_00.ref @@ -1,5 +1,5 @@ -{"timestamp": "2025-01-07T17:00:00.000000", "log_level": "INFO", "user_id": "user123", "action_type": "CREATE_POST", "message": "User created a new blog post titled \"Understanding AI\"."} -{"timestamp": "2025-01-07T17:05:00.000000", "log_level": "INFO", "user_id": "user123", "action_type": "EDIT_POST", "message": "User edited the blog post \"Understanding AI\"."} -{"timestamp": "2025-01-07T17:10:00.000000", "log_level": "INFO", "user_id": "user456", "action_type": "COMMENT", "message": "User commented on \"Understanding AI\": \"Great insights!\"."} -{"timestamp": "2025-01-07T17:15:00.000000", "log_level": "ERROR", "user_id": "user123", "action_type": "DELETE_POST", "message": "User attempted to delete a post that does not exist."} -{"timestamp": "2025-01-07T17:20:00.000000", "log_level": "INFO", "user_id": "user789", "action_type": "LIKE", "message": "User liked the blog post \"Understanding AI\"."} \ No newline at end of file +{"timestamp": "2025-01-07T17:00:00Z", "log_level": "INFO", "user_id": "user123", "action_type": "CREATE_POST", "message": "User created a new blog post titled \"Understanding AI\"."} +{"timestamp": "2025-01-07T17:05:00Z", "log_level": "INFO", "user_id": "user123", "action_type": "EDIT_POST", "message": "User edited the blog post \"Understanding AI\"."} +{"timestamp": "2025-01-07T17:10:00Z", "log_level": "INFO", "user_id": "user456", "action_type": "COMMENT", "message": "User commented on \"Understanding AI\": \"Great insights!\"."} +{"timestamp": "2025-01-07T17:15:00Z", "log_level": "ERROR", "user_id": "user123", "action_type": "DELETE_POST", "message": "User attempted to delete a post that does not exist."} +{"timestamp": "2025-01-07T17:20:00Z", "log_level": "INFO", "user_id": "user789", "action_type": "LIKE", "message": "User liked the blog post \"Understanding AI\"."} \ No newline at end of file diff --git a/bats/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref b/bats/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref index c5d67ab..c5b3eb1 100644 --- a/bats/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref +++ b/bats/data/reference/tests/test_parse_example_logs_with_argument/step_00.ref @@ -1,5 +1,5 @@ -{"timestamp": "2025-01-07T18:00:00.000000", "log_level": "INFO", "user_id": "user123", "action_type": "CREATE_POST", "message": "User created a new blog post titled \"Understanding AI\"."} -{"timestamp": "2025-01-07T18:05:00.000000", "log_level": "INFO", "user_id": "user123", "action_type": "EDIT_POST", "message": "User edited the blog post \"Understanding AI\"."} -{"timestamp": "2025-01-07T18:10:00.000000", "log_level": "INFO", "user_id": "user456", "action_type": "COMMENT", "message": "User commented on \"Understanding AI\": \"Great insights!\"."} -{"timestamp": "2025-01-07T18:15:00.000000", "log_level": "ERROR", "user_id": "user123", "action_type": "DELETE_POST", "message": "User attempted to delete a post that does not exist."} -{"timestamp": "2025-01-07T18:20:00.000000", "log_level": "INFO", "user_id": "user789", "action_type": "LIKE", "message": "User liked the blog post \"Understanding AI\"."} \ No newline at end of file +{"timestamp": "2025-01-07T18:00:00Z", "log_level": "INFO", "user_id": "user123", "action_type": "CREATE_POST", "message": "User created a new blog post titled \"Understanding AI\"."} +{"timestamp": "2025-01-07T18:05:00Z", "log_level": "INFO", "user_id": "user123", "action_type": "EDIT_POST", "message": "User edited the blog post \"Understanding AI\"."} +{"timestamp": "2025-01-07T18:10:00Z", "log_level": "INFO", "user_id": "user456", "action_type": "COMMENT", "message": "User commented on \"Understanding AI\": \"Great insights!\"."} +{"timestamp": "2025-01-07T18:15:00Z", "log_level": "ERROR", "user_id": "user123", "action_type": "DELETE_POST", "message": "User attempted to delete a post that does not exist."} +{"timestamp": "2025-01-07T18:20:00Z", "log_level": "INFO", "user_id": "user789", "action_type": "LIKE", "message": "User liked the blog post \"Understanding AI\"."} \ No newline at end of file