Skip to content

Commit af92632

Browse files
author
ci bot
committed
Merge branch 'aarthy/text-fixes' into 'enterprise'
fix(monitors): misc style and quick start updates See merge request dkinternal/testgen/dataops-testgen!399
2 parents 77b6ba3 + 904767c commit af92632

60 files changed

Lines changed: 145 additions & 93 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

testgen/commands/run_quick_start.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import math
23
import random
34
from datetime import datetime
45
from typing import Any
@@ -116,6 +117,19 @@ def _get_quick_start_params_mapping(iteration: int = 0) -> dict:
116117
}
117118

118119

120+
def _metric_cumulative_shift(iteration: int) -> tuple[float, float]:
121+
"""Compute cumulative metric shifts at a given iteration for Metric_Trend monitors.
122+
123+
Returns (discount_shift, price_shift) — the total shift from baseline
124+
that should be applied to the underlying data at this iteration.
125+
Uses composite sine waves for organic-looking oscillation patterns.
126+
"""
127+
i = iteration
128+
discount = -1.0 + 1.8 * math.sin(2 * math.pi * i / 14 + math.pi) + 0.7 * math.sin(2 * math.pi * i / 6 + math.pi + 0.5)
129+
price = 80 * math.sin(2 * math.pi * i / 16) + 40 * math.sin(2 * math.pi * i / 7 + 0.3) + 100
130+
return discount, price
131+
132+
119133
def _get_monitor_params_mapping(run_date: datetime, iteration: int = 0) -> dict:
120134
# Volume: linear growth with jitter, spike at specific iteration for anomaly
121135
if iteration == 37:
@@ -126,6 +140,12 @@ def _get_monitor_params_mapping(run_date: datetime, iteration: int = 0) -> dict:
126140
# Freshness: update every other iteration, late update for anomaly
127141
is_update_suppliers_iter = (iteration % 2 == 0 and iteration != 38) or iteration == 39
128142

143+
# Metrics: compute deltas for discount and price shifts
144+
curr_discount, curr_price = _metric_cumulative_shift(iteration)
145+
prev_discount, prev_price = _metric_cumulative_shift(iteration - 1) if iteration > 1 else (0.0, 0.0)
146+
discount_delta = round(curr_discount - prev_discount, 3)
147+
price_delta = round(curr_price - prev_price, 2)
148+
129149
return {
130150
**_get_settings_params_mapping(),
131151
"ITERATION_NUMBER": iteration,
@@ -137,6 +157,8 @@ def _get_monitor_params_mapping(run_date: datetime, iteration: int = 0) -> dict:
137157
"IS_CREATE_RETURNS_TABLE_ITER": iteration == 32,
138158
"IS_DELETE_CUSTOMER_ITER": iteration in (18, 22, 34),
139159
"IS_UPDATE_SUPPLIERS_ITER": is_update_suppliers_iter,
160+
"DISCOUNT_DELTA": discount_delta,
161+
"PRICE_DELTA": price_delta,
140162
}
141163

142164

testgen/template/dbsetup_test_types/test_types_Aggregate_Balance.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_types:
44
test_name_short: Aggregate Balance
55
test_name_long: Aggregate values per group match reference
66
test_description: |-
7-
Tests for exact match in aggregate values for each set of column values vs. reference dataset
7+
Tests for exact match in aggregate measure for each set of column values compared to reference dataset.
88
except_message: |-
99
Aggregate measure per set of column values does not exactly match reference dataset.
1010
measure_uom: Mismatched measures

testgen/template/dbsetup_test_types/test_types_Aggregate_Balance_Percent.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_types:
44
test_name_short: Aggregate Balance Percent
55
test_name_long: Aggregate measure per group within percent of reference
66
test_description: |-
7-
Tests that aggregate measure for each set of column values fall within a percent range above or below the measure for reference dataset
7+
Tests that aggregate measure for each set of column values falls within a percent range above or below the measure for reference dataset.
88
except_message: |-
99
Aggregate measure per set of column values is outside percent range of reference dataset.
1010
measure_uom: Mismatched measures

testgen/template/dbsetup_test_types/test_types_Aggregate_Balance_Range.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_types:
44
test_name_short: Aggregate Balance Range
55
test_name_long: Aggregate measure per group within hard range of reference
66
test_description: |-
7-
Tests that aggregate measure for each set of column values fall within a hard range above or below the measure for reference dataset
7+
Tests that aggregate measure for each set of column values falls within a hard range above or below the measure for reference dataset.
88
except_message: |-
99
Aggregate measure per set of column values is outside expected range of reference dataset.
1010
measure_uom: Mismatched measures

testgen/template/dbsetup_test_types/test_types_Aggregate_Minimum.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_types:
44
test_name_short: Aggregate Minimum
55
test_name_long: Aggregate values per group are at or above reference
66
test_description: |-
7-
Tests that aggregate values for each set of column values are at least the same as reference dataset
7+
Tests that aggregate values for each set of column values are at least the same as reference dataset.
88
except_message: |-
99
Aggregate measure per set of column values is not at least the same as reference dataset.
1010
measure_uom: Mismatched measures

testgen/template/dbsetup_test_types/test_types_Alpha_Trunc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ test_types:
44
test_name_short: Alpha Truncation
55
test_name_long: Maximum character count consistent
66
test_description: |-
7-
Tests that the maximum count of characters in a column value has not dropped vs. baseline data
7+
Tests that maximum count of characters in column values has not dropped compared to baseline data.
88
except_message: |-
9-
Maximum length of values has dropped from prior expected length.
9+
Maximum length of values has dropped compared to baseline.
1010
measure_uom: Values over max
1111
measure_uom_description: null
1212
selection_criteria: |-

testgen/template/dbsetup_test_types/test_types_Avg_Shift.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_types:
44
test_name_short: Average Shift
55
test_name_long: Column mean is consistent with reference
66
test_description: |-
7-
Tests for statistically-significant shift in mean value for column from average calculated at baseline.
7+
Tests for statistically significant shift in mean value for column from average calculated at baseline.
88
except_message: |-
99
Standardized difference between averages is over the selected threshold level.
1010
measure_uom: Difference Measure

testgen/template/dbsetup_test_types/test_types_CUSTOM.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_types:
44
test_name_short: Custom Test
55
test_name_long: Custom-defined business rule
66
test_description: |-
7-
Custom SQL Query Test
7+
Custom SQL Query Test. A highly flexible business-rule test covering any error state that can be expressed by a SQL query against one or more tables in the database.
88
except_message: |-
99
Errors were detected according to test definition.
1010
measure_uom: Errors found

testgen/template/dbsetup_test_types/test_types_Combo_Match.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_types:
44
test_name_short: Reference Match
55
test_name_long: Column values or combinations found in reference
66
test_description: |-
7-
Tests for the presence of one or a set of column values in a reference table
7+
Tests for the presence of one or a set of column values in reference dataset.
88
except_message: |-
99
Column value combinations are not found in reference table values.
1010
measure_uom: Missing values

testgen/template/dbsetup_test_types/test_types_Condition_Flag.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ test_types:
44
test_name_short: Custom Condition
55
test_name_long: Column values match pre-defined condition
66
test_description: |-
7-
Tests that each record in the table matches a pre-defined, custom condition
7+
Tests that each record in the table matches a predefined custom condition.
88
except_message: |-
9-
Value(s) found not matching defined condition.
9+
Values found not matching defined condition.
1010
measure_uom: Values Failing
1111
measure_uom_description: null
1212
selection_criteria: null

0 commit comments

Comments
 (0)