-
Notifications
You must be signed in to change notification settings - Fork 84
feat(integration-tests): Add core binary tests for the log-converter and clp-s pipeline.
#1591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "timestamp": "01 May 2025 01:02:03,456", | ||
| "message": " INFO f81d4fae-7dec-11d0-a765-00a0c91e6bf6 [9] (2) a.b.c: Hello world\n" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 01 May 2025 01:02:03,456 INFO f81d4fae-7dec-11d0-a765-00a0c91e6bf6 [9] (2) a.b.c: Hello world |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"timestamp": "08 Oct 2025 20:00:31,125", "message": " ERROR cc994739-866c-4789-9596-cbd08b4a5ebd [pool-5-thread-515] c.a.r.c.e.PreferenceBasedRulesExecutor Vasanth PreferenceBasedRulesExecutor processInvalidRuleException: {FAILURE:\"MVEL failure: could not execute facts for rule.\",EXCEPTION_TYPE:\"org.mvel.UnresolveablePropertyException \",RETRY_COUNT:2,REASON:\"unable to resolve token: \\u201c$ABCString \",VARIABLE_VALUES:{abc:\"XXX \",$randomVariable:\"000 \"}\\n\n"} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 08 Oct 2025 20:00:31,125 ERROR cc994739-866c-4789-9596-cbd08b4a5ebd [pool-5-thread-515] c.a.r.c.e.PreferenceBasedRulesExecutor Vasanth PreferenceBasedRulesExecutor processInvalidRuleException: {FAILURE:"MVEL failure: could not execute facts for rule.",EXCEPTION_TYPE:"org.mvel.UnresolveablePropertyException ",RETRY_COUNT:2,REASON:"unable to resolve token: \u201c$ABCString ",VARIABLE_VALUES:{abc:"XXX ",$randomVariable:"000 "}\n |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,8 @@ | |||||||||||||
| compression and decompression. | ||||||||||||||
| """ | ||||||||||||||
|
|
||||||||||||||
| from pathlib import Path | ||||||||||||||
|
|
||||||||||||||
| import pytest | ||||||||||||||
|
|
||||||||||||||
| from tests.utils.asserting_utils import run_and_assert | ||||||||||||||
|
|
@@ -15,10 +17,14 @@ | |||||||||||||
| from tests.utils.utils import ( | ||||||||||||||
| is_dir_tree_content_equal, | ||||||||||||||
| is_json_file_structurally_equal, | ||||||||||||||
| unlink, | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| pytestmark = pytest.mark.core | ||||||||||||||
|
|
||||||||||||||
| # Constants | ||||||||||||||
| CLP_S_CANONICAL_OUTPUT_FILENAME = "original" | ||||||||||||||
|
|
||||||||||||||
| text_datasets = pytest.mark.parametrize( | ||||||||||||||
| "test_logs_fixture", | ||||||||||||||
| [ | ||||||||||||||
|
|
@@ -128,9 +134,8 @@ def test_clp_s_identity_transform( | |||||||||||||
| ) | ||||||||||||||
| _clp_s_compress_and_decompress(core_config, consolidated_json_test_paths) | ||||||||||||||
|
|
||||||||||||||
| _consolidated_json_file_name = "original" | ||||||||||||||
| input_path = consolidated_json_test_paths.logs_source_dir / _consolidated_json_file_name | ||||||||||||||
| output_path = consolidated_json_test_paths.decompression_dir / _consolidated_json_file_name | ||||||||||||||
| input_path = consolidated_json_test_paths.logs_source_dir / CLP_S_CANONICAL_OUTPUT_FILENAME | ||||||||||||||
| output_path = consolidated_json_test_paths.decompression_dir / CLP_S_CANONICAL_OUTPUT_FILENAME | ||||||||||||||
| assert is_json_file_structurally_equal(input_path, output_path), ( | ||||||||||||||
| f"Mismatch between clp-s input {input_path} and output {output_path}." | ||||||||||||||
| ) | ||||||||||||||
|
|
@@ -139,6 +144,58 @@ def test_clp_s_identity_transform( | |||||||||||||
| consolidated_json_test_paths.clear_test_outputs() | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @pytest.mark.clp_s | ||||||||||||||
| def test_log_converter_clp_s_identity_transform( | ||||||||||||||
| core_config: CoreConfig, | ||||||||||||||
| integration_test_config: IntegrationTestConfig, | ||||||||||||||
| ) -> None: | ||||||||||||||
| """ | ||||||||||||||
| Validate the end-to-end functionality of the `log-converter` and `clp-s` pipeline. | ||||||||||||||
|
|
||||||||||||||
| This test ensures that: | ||||||||||||||
| 1. `log-converter` correctly transforms unstructured logs into key-value IR format. | ||||||||||||||
| 2. The kv-IR output can be compressed and decompressed by `clp-s` without data loss. | ||||||||||||||
|
|
||||||||||||||
| :param core_config: | ||||||||||||||
| :param integration_test_config: | ||||||||||||||
| """ | ||||||||||||||
| log_converter_out_dir = integration_test_config.test_root_dir / "log-converter-outputs" | ||||||||||||||
| log_converter_out_dir.mkdir(parents=True, exist_ok=True) | ||||||||||||||
| log_converter_bin_path_str = str(core_config.log_converter_binary_path) | ||||||||||||||
|
|
||||||||||||||
| unstructured_logs_dir = Path(__file__).resolve().parent / "data" / "unstructured-logs" | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
How would you feel about having this be dependent on a new env variable in |
||||||||||||||
| for test_case_dir in unstructured_logs_dir.iterdir(): | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my high-level comment about the dependence on directory structure to enumerate test cases. |
||||||||||||||
| if not test_case_dir.is_dir(): | ||||||||||||||
| continue | ||||||||||||||
|
|
||||||||||||||
| test_name = test_case_dir.name | ||||||||||||||
| kv_ir_out = log_converter_out_dir / test_name | ||||||||||||||
| unlink(kv_ir_out) | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It feels odd to have this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because there may be leftover files from a previous test that we'd like to remove
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, but if the |
||||||||||||||
|
|
||||||||||||||
| # fmt: off | ||||||||||||||
| run_and_assert([ | ||||||||||||||
| log_converter_bin_path_str, | ||||||||||||||
| str(test_case_dir / "raw.log"), | ||||||||||||||
| "--output-dir", str(kv_ir_out), | ||||||||||||||
| ]) | ||||||||||||||
| # fmt: on | ||||||||||||||
|
|
||||||||||||||
| test_paths = CompressionTestConfig( | ||||||||||||||
| test_name=f"log-converter-clp-s-{test_name}", | ||||||||||||||
| logs_source_dir=kv_ir_out, | ||||||||||||||
| integration_test_config=integration_test_config, | ||||||||||||||
| ) | ||||||||||||||
| _clp_s_compress_and_decompress(core_config, test_paths) | ||||||||||||||
|
|
||||||||||||||
| expected_out = test_case_dir / "converted.json" | ||||||||||||||
| actual_out = test_paths.decompression_dir / CLP_S_CANONICAL_OUTPUT_FILENAME | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a bit of trouble with the value of |
||||||||||||||
| assert is_json_file_structurally_equal(expected_out, actual_out), ( | ||||||||||||||
| f"Mismatch between {expected_out}(expected) and {actual_out}(actual)." | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| test_paths.clear_test_outputs() | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def _clp_s_compress_and_decompress( | ||||||||||||||
| core_config: CoreConfig, test_paths: CompressionTestConfig | ||||||||||||||
| ) -> None: | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See high-level comment.