Skip to content

Commit eb7d179

Browse files
Fix test by making training period overlap detection period
- Changed training period from 14 to 30 days to overlap with 7-day detection period - Changed normal data from 14 to 30 days (days 37-7 ago) - Changed days_back from 30 to 40 to cover entire data range - Changed sensitivity from 2 to 3 to allow anomaly absorption when included in training - Set backfill_days to 0 to avoid independent exclusion of recent data - This matches the pattern used in test_volume_anomalies.py::test_exclude_detection_from_training Co-Authored-By: Yosef Arbiv <[email protected]>
1 parent 2558e32 commit eb7d179

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

integration_tests/tests/test_freshness_anomalies.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,20 @@ def test_exclude_detection_from_training(test_id: str, dbt_project: DbtProject):
241241
Test the exclude_detection_period_from_training flag functionality for freshness anomalies.
242242
243243
Scenario:
244-
- 14 days of normal data with frequent updates (every 2 hours)
245-
- 7 days of anomalous data (only 1 update per day at midnight) in detection period
244+
- 30 days of normal data with frequent updates (every 2 hours)
245+
- 7 days of anomalous data (only 1 update per day at noon) in detection period
246246
- Without exclusion: anomaly gets included in training baseline, test passes (misses anomaly)
247247
- With exclusion: anomaly excluded from training, test fails (detects anomaly)
248248
"""
249249
utc_now = datetime.utcnow().replace(hour=0, minute=0, second=0, microsecond=0)
250250

251-
# Generate 14 days of normal data with frequent updates (every 2 hours)
251+
# Generate 30 days of normal data with frequent updates (every 2 hours)
252252
normal_data = [
253253
{TIMESTAMP_COLUMN: date.strftime(DATE_FORMAT)}
254254
for date in generate_dates(
255-
base_date=utc_now - timedelta(days=21),
255+
base_date=utc_now - timedelta(days=37),
256256
step=timedelta(hours=2),
257-
days_back=14,
257+
days_back=30,
258258
)
259259
]
260260

@@ -273,12 +273,12 @@ def test_exclude_detection_from_training(test_id: str, dbt_project: DbtProject):
273273
# Test 1: WITHOUT exclusion (should pass - misses the anomaly because it's included in training)
274274
test_args_without_exclusion = {
275275
"timestamp_column": TIMESTAMP_COLUMN,
276-
"training_period": {"period": "day", "count": 14},
276+
"training_period": {"period": "day", "count": 30},
277277
"detection_period": {"period": "day", "count": 7},
278278
"time_bucket": {"period": "day", "count": 1},
279-
"days_back": 30,
280-
"backfill_days": 7,
281-
"sensitivity": 2,
279+
"days_back": 40,
280+
"backfill_days": 0,
281+
"sensitivity": 3,
282282
"min_training_set_size": 5,
283283
"anomaly_direction": "spike",
284284
"ignore_small_changes": {

0 commit comments

Comments
 (0)