Skip to content

Commit 4bfcb56

Browse files
naspiratoblinkov
authored andcommitted
fix tests flaky window (#15268)
1 parent ef892e8 commit 4bfcb56

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

.github/scripts/analytics/flaky_tests_history.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def main():
8585
history_for_n_day = args.days_window
8686
build_type = args.build_type
8787
branch = args.branch
88-
89-
print(f'Getting hostory in window {history_for_n_day} days')
90-
88+
89+
print(f'Getting history in window {history_for_n_day} days')
90+
9191

9292
if "CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS" not in os.environ:
9393
print(
@@ -109,17 +109,17 @@ def main():
109109
session = ydb.retry_operation_sync(
110110
lambda: driver.table_client.session().create()
111111
)
112-
112+
113113
# settings, paths, consts
114114
tc_settings = ydb.TableClientSettings().with_native_date_in_result_sets(enabled=True)
115115
table_client = ydb.TableClient(driver, tc_settings)
116-
116+
117117
table_path = f'test_results/analytics/flaky_tests_window_{history_for_n_day}_days'
118-
default_start_date = datetime.date(2024, 9, 1)
119-
118+
default_start_date = datetime.date(2025, 2, 28)
119+
120120
with ydb.SessionPool(driver) as pool:
121121
create_tables(pool, table_path)
122-
122+
123123
# geting last date from history
124124
last_date_query = f"""select max(date_window) as max_date_window from `{table_path}`
125125
where build_type = '{build_type}' and branch = '{branch}'"""
@@ -132,16 +132,16 @@ def main():
132132
results = results + result.result_set.rows
133133
except StopIteration:
134134
break
135-
135+
136136
if results[0] and results[0].get( 'max_date_window', default_start_date) is not None and results[0].get( 'max_date_window', default_start_date) > default_start_date:
137137
last_datetime = results[0].get(
138138
'max_date_window', default_start_date)
139139

140140
else:
141141
last_datetime = default_start_date
142-
142+
143143
last_date = last_datetime.strftime('%Y-%m-%d')
144-
144+
145145
print(f'last hisotry date: {last_date}')
146146
# getting history for dates >= last_date
147147

@@ -178,7 +178,7 @@ def main():
178178
max(run_timestamp) as last_run
179179
from (
180180
select * from (
181-
181+
182182
select distinct
183183
full_name,
184184
suite_folder,
@@ -187,30 +187,30 @@ def main():
187187
Date('{date}') as date_base,
188188
'{build_type}' as build_type,
189189
'{branch}' as branch
190-
from `test_results/analytics/testowners`
190+
from `test_results/analytics/testowners`
191+
where run_timestamp_last >= Date('{date}') - Interval('P30D')
191192
) as test_and_date
192193
left JOIN (
193-
194+
194195
select
195196
suite_folder || '/' || test_name as full_name,
196197
run_timestamp,
197198
status
198199
from `test_results/test_runs_column`
199200
where
200201
run_timestamp <= Date('{date}') + Interval("P1D")
201-
and run_timestamp >= Date('{date}') - {history_for_n_day+1}*Interval("P1D")
202-
202+
and run_timestamp >= Date('{date}') {'' if history_for_n_day==1 else f'-{history_for_n_day}*Interval("P1D")'}
203203
and job_name in (
204204
'Nightly-run',
205205
'Regression-run',
206206
'Regression-whitelist-run',
207-
'Postcommit_relwithdebinfo',
207+
'Postcommit_relwithdebinfo',
208208
'Postcommit_asan'
209-
)
209+
)
210210
and build_type = '{build_type}'
211211
and branch = '{branch}'
212212
order by full_name,run_timestamp desc
213-
213+
214214
) as hist
215215
ON test_and_date.full_name=hist.full_name
216216
)

0 commit comments

Comments
 (0)