Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 33 additions & 4 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ def test_file_based_integration(tmp_path):
Tests the full baseline and analyze pipeline using file-based data.
"""
# Define paths
data_file = "data/example.json"
baseline_data = "data/example.json"
analyze_data = "data/example2.bz2"
baseline_output_dir = tmp_path / "baseline_output"
analyze_output_dir = tmp_path / "analyze_output"

# --- Baseline generation ---
baseline_cmd = [
sys.executable,
"main.py",
data_file,
baseline_data,
"-m",
"baseline",
"-o",
Expand All @@ -61,18 +62,46 @@ def test_file_based_integration(tmp_path):
analyze_cmd = [
sys.executable,
"main.py",
data_file,
analyze_data,
"-m",
"analyze",
"-i",
str(baseline_file),
"-o",
str(analyze_output_dir),
"--path-stats",
"--source-type",
"probe",
"--source-id",
"1012770",
"--dest-radius",
"45.411974347371476,2.716824328216018:2000",
"--dest-id",
"1012763",
"--plot-metrics",
"rtt",
"rtt_std",
"first_hop_rtt",
"observed_pathlen",
"successful_pathlen",
"duration",
"timeouts",
"success_rate",
"timeout_rate",
"--plot-types",
"hist",
"scatter",
"rolling",
"boxplot",
"--plot-aggregations",
"daily",
"hourly",
"dayofweek",
"hourofday",
"--formats",
"png",
"--no-line-count",
"--highlight-outliers",
]
analyze_result = subprocess.run(analyze_cmd, capture_output=True, text=True)
assert analyze_result.returncode == 0, f"Analysis run failed: {analyze_result.stderr}"
Expand Down Expand Up @@ -104,7 +133,7 @@ def test_clickhouse_based_integration(tmp_path):

# --- Analysis run from ClickHouse ---
analyze_output_dir = tmp_path / "ch_analyze_output"
analyze_cmd = [sys.executable, "main.py", "--clickhouse", "-m", "analyze", "-i", str(baseline_file), "-o", str(analyze_output_dir)]
analyze_cmd = [sys.executable, "main.py", "--clickhouse", "-m", "analyze", "--path-stats", "--analyze-core-paths","-i", str(baseline_file), "-o", str(analyze_output_dir)]
subprocess.run(analyze_cmd, check=True)
analysis_files = list(analyze_output_dir.glob("*.json"))
assert len(analysis_files) == 1, "Expected one analysis JSON file from ClickHouse"