summaryrefslogtreecommitdiff
path: root/buildscripts/resmoke_tests_runtime_validate.py
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /buildscripts/resmoke_tests_runtime_validate.py
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'buildscripts/resmoke_tests_runtime_validate.py')
-rw-r--r--buildscripts/resmoke_tests_runtime_validate.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/buildscripts/resmoke_tests_runtime_validate.py b/buildscripts/resmoke_tests_runtime_validate.py
index 5c17d1ee5f8..cffcbf48e9d 100644
--- a/buildscripts/resmoke_tests_runtime_validate.py
+++ b/buildscripts/resmoke_tests_runtime_validate.py
@@ -3,6 +3,7 @@
import json
import sys
from collections import namedtuple
+from datetime import datetime, timedelta
from statistics import mean
from typing import Dict, List
@@ -12,8 +13,7 @@ import structlog
from buildscripts.resmokelib.testing.report import TestInfo, TestReport
from buildscripts.resmokelib.utils import get_task_name_without_suffix
from buildscripts.util.cmdutils import enable_logging
-
-from buildscripts.util.teststats import HistoricTaskData, HistoricalTestInformation
+from evergreen import RetryingEvergreenApi, TestStats
LOGGER = structlog.get_logger("buildscripts.resmoke_tests_runtime_validate")
@@ -34,12 +34,17 @@ def parse_resmoke_report(report_file: str) -> List[TestInfo]:
return [test_info for test_info in test_report.test_infos if "jstests" in test_info.test_file]
-def get_historic_stats(project_id: str, task_name: str,
- build_variant: str) -> List[HistoricalTestInformation]:
+def get_historic_stats(evg_api_config: str, project_id: str, test_files: List[str], task_name: str,
+ build_variant: str) -> List[TestStats]:
"""Get historic test stats."""
+ evg_api = RetryingEvergreenApi.get_api(config_file=evg_api_config)
+ before_date = datetime.today()
+ after_date = before_date - timedelta(days=LOOK_BACK_NUM_DAYS)
base_task_name = get_task_name_without_suffix(task_name, build_variant).replace(
BURN_IN_PREFIX, "")
- return HistoricTaskData.get_stats_from_s3(project_id, base_task_name, build_variant)
+ return evg_api.test_stats_by_project(project_id=project_id, after_date=after_date,
+ before_date=before_date, tests=test_files,
+ tasks=[base_task_name], variants=[build_variant])
def make_stats_map(stats: List[_TestData]) -> Dict[str, List[float]]:
@@ -58,10 +63,13 @@ def make_stats_map(stats: List[_TestData]) -> Dict[str, List[float]]:
@click.command()
@click.option("--resmoke-report-file", type=str, required=True,
help="Location of resmoke's report JSON file.")
+@click.option("--evg-api-config", type=str, required=True,
+ help="Location of evergreen api configuration.")
@click.option("--project-id", type=str, required=True, help="Evergreen project id.")
@click.option("--build-variant", type=str, required=True, help="Evergreen build variant name.")
@click.option("--task-name", type=str, required=True, help="Evergreen task name.")
-def main(resmoke_report_file: str, project_id: str, build_variant: str, task_name: str) -> None:
+def main(resmoke_report_file: str, evg_api_config: str, project_id: str, build_variant: str,
+ task_name: str) -> None:
"""Compare resmoke tests runtime with historic stats."""
enable_logging(verbose=False)
@@ -71,9 +79,10 @@ def main(resmoke_report_file: str, project_id: str, build_variant: str, task_nam
for test_info in current_test_infos
])
- historic_stats = get_historic_stats(project_id, task_name, build_variant)
+ historic_stats = get_historic_stats(evg_api_config, project_id, list(current_stats_map.keys()),
+ task_name, build_variant)
historic_stats_map = make_stats_map([
- _TestData(test_stats.test_name, test_stats.avg_duration_pass)
+ _TestData(test_stats.test_file, test_stats.avg_duration_pass)
for test_stats in historic_stats
])