Skip to content

fix tests flaky window #15268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025
Merged
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
38 changes: 19 additions & 19 deletions .github/scripts/analytics/flaky_tests_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def main():
history_for_n_day = args.days_window
build_type = args.build_type
branch = args.branch
print(f'Getting hostory in window {history_for_n_day} days')

print(f'Getting history in window {history_for_n_day} days')


if "CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS" not in os.environ:
print(
Expand All @@ -109,17 +109,17 @@ def main():
session = ydb.retry_operation_sync(
lambda: driver.table_client.session().create()
)

# settings, paths, consts
tc_settings = ydb.TableClientSettings().with_native_date_in_result_sets(enabled=True)
table_client = ydb.TableClient(driver, tc_settings)

table_path = f'test_results/analytics/flaky_tests_window_{history_for_n_day}_days'
default_start_date = datetime.date(2024, 9, 1)
default_start_date = datetime.date(2025, 2, 28)

with ydb.SessionPool(driver) as pool:
create_tables(pool, table_path)

# geting last date from history
last_date_query = f"""select max(date_window) as max_date_window from `{table_path}`
where build_type = '{build_type}' and branch = '{branch}'"""
Expand All @@ -132,16 +132,16 @@ def main():
results = results + result.result_set.rows
except StopIteration:
break

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:
last_datetime = results[0].get(
'max_date_window', default_start_date)

else:
last_datetime = default_start_date

last_date = last_datetime.strftime('%Y-%m-%d')

print(f'last hisotry date: {last_date}')
# getting history for dates >= last_date

Expand Down Expand Up @@ -178,7 +178,7 @@ def main():
max(run_timestamp) as last_run
from (
select * from (

select distinct
full_name,
suite_folder,
Expand All @@ -187,30 +187,30 @@ def main():
Date('{date}') as date_base,
'{build_type}' as build_type,
'{branch}' as branch
from `test_results/analytics/testowners`
from `test_results/analytics/testowners`
where run_timestamp_last >= Date('{date}') - Interval('P30D')
) as test_and_date
left JOIN (

select
suite_folder || '/' || test_name as full_name,
run_timestamp,
status
from `test_results/test_runs_column`
where
run_timestamp <= Date('{date}') + Interval("P1D")
and run_timestamp >= Date('{date}') - {history_for_n_day+1}*Interval("P1D")

and run_timestamp >= Date('{date}') {'' if history_for_n_day==1 else f'-{history_for_n_day}*Interval("P1D")'}
and job_name in (
'Nightly-run',
'Regression-run',
'Regression-whitelist-run',
'Postcommit_relwithdebinfo',
'Postcommit_relwithdebinfo',
'Postcommit_asan'
)
)
and build_type = '{build_type}'
and branch = '{branch}'
order by full_name,run_timestamp desc

) as hist
ON test_and_date.full_name=hist.full_name
)
Expand Down