Commit 15c3290
Add exclude_detection_period_from_training flag to dimension anomaly test (#890)
* Add exclude_detection_period_from_training flag to dimension anomaly test
- Added exclude_detection_period_from_training parameter to test_dimension_anomalies macro signature with default value false
- Passed the parameter through to get_anomalies_test_configuration
- This brings dimension anomalies in line with table/volume anomalies which already support this flag
- The underlying logic in get_anomaly_scores_query.sql already handles this parameter for all anomaly types
Co-Authored-By: Yosef Arbiv <[email protected]>
* Add integration test for exclude_detection_period_from_training in dimension anomalies
- Added test_dimension_exclude_detection_from_training to demonstrate the flag's behavior
- Test shows that without exclusion, anomaly is missed (test passes) because training includes the detection period
- Test shows that with exclusion, anomaly is detected (test fails) because training excludes the detection period
- Uses 30 days of normal data with variance (45/50/55 pattern) and 7 days of anomalous data (72/28 distribution)
- Follows the same pattern as test_exclude_detection_from_training in test_volume_anomalies.py
Co-Authored-By: Yosef Arbiv <[email protected]>
* Fix test_dimension_exclude_detection_from_training: shorten test ID suffixes to avoid Postgres 63-char limit
Co-Authored-By: Yosef Arbiv <[email protected]>
* Refactor test to use parametrization: rename to test_anomaly_in_detection_period
- Rename test_dimension_exclude_detection_from_training to test_anomaly_in_detection_period
- Add @pytest.mark.parametrize decorator with exclude_detection and expected_status parameters
- Use descriptive IDs: include_detection_in_training and exclude_detection_from_training
- Consolidate two test cases into one parametrized test for better maintainability
- Addresses reviewer feedback on PR #890
Co-Authored-By: Yosef Arbiv <[email protected]>
* Fix Postgres 63-char identifier limit: shorten parametrize IDs and remove redundant suffix
- Change parametrize IDs from 'include_detection_in_training'/'exclude_detection_from_training' to 'exclude_false'/'exclude_true'
- Remove redundant suffix (_incl/_excl) since pytest parametrize IDs already differentiate test cases
- New table names: test_anomaly_in_detection_period_exclude_false (44 chars) and test_anomaly_in_detection_period_exclude_true (43 chars)
- Both are well under Postgres 63-character limit
- Fixes CI failures on Postgres (latest_official and latest_pre)
Co-Authored-By: Yosef Arbiv <[email protected]>
* Fix test_anomaly_in_detection_period to use date object instead of datetime
Change utc_now from datetime.utcnow() to datetime.utcnow().date() to match
the pattern used in other tests. Date arithmetic already works correctly
with date objects.
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Yosef Arbiv <[email protected]>
Co-authored-by: arbiv <[email protected]>1 parent d6c7bb3 commit 15c3290
File tree
2 files changed
+104
-2
lines changed- integration_tests/tests
- macros/edr/tests
2 files changed
+104
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
0 commit comments