summaryrefslogtreecommitdiff
path: root/buildscripts/tests/util
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/tests/util
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/tests/util')
-rw-r--r--buildscripts/tests/util/test_taskname.py6
-rw-r--r--buildscripts/tests/util/test_teststats.py110
2 files changed, 4 insertions, 112 deletions
diff --git a/buildscripts/tests/util/test_taskname.py b/buildscripts/tests/util/test_taskname.py
index 637ee59321e..7f3296ca1aa 100644
--- a/buildscripts/tests/util/test_taskname.py
+++ b/buildscripts/tests/util/test_taskname.py
@@ -28,7 +28,7 @@ class TestRemoveGenSuffix(unittest.TestCase):
class TestDetermineTaskBaseName(unittest.TestCase):
def test_task_name_with_build_variant_should_strip_bv_and_sub_task_index(self):
- bv = "enterprise-rhel-8-64-bit-dynamic-required"
+ bv = "enterprise-rhel-80-64-bit-dynamic-required"
task_name = f"auth_23_{bv}"
base_task_name = under_test.determine_task_base_name(task_name, bv)
@@ -36,7 +36,7 @@ class TestDetermineTaskBaseName(unittest.TestCase):
self.assertEqual("auth", base_task_name)
def test_task_name_without_build_variant_should_strip_sub_task_index(self):
- bv = "enterprise-rhel-8-64-bit-dynamic-required"
+ bv = "enterprise-rhel-80-64-bit-dynamic-required"
task_name = "auth_314"
base_task_name = under_test.determine_task_base_name(task_name, bv)
@@ -44,7 +44,7 @@ class TestDetermineTaskBaseName(unittest.TestCase):
self.assertEqual("auth", base_task_name)
def test_task_name_without_build_variant_or_subtask_index_should_self(self):
- bv = "enterprise-rhel-8-64-bit-dynamic-required"
+ bv = "enterprise-rhel-80-64-bit-dynamic-required"
task_name = "auth"
base_task_name = under_test.determine_task_base_name(task_name, bv)
diff --git a/buildscripts/tests/util/test_teststats.py b/buildscripts/tests/util/test_teststats.py
index 9e72d87a737..ebba930d032 100644
--- a/buildscripts/tests/util/test_teststats.py
+++ b/buildscripts/tests/util/test_teststats.py
@@ -2,12 +2,8 @@
import datetime
import unittest
-from json import JSONDecodeError
-from unittest.mock import patch
from mock import Mock
-from mock.mock import MagicMock
-from requests import Session
import buildscripts.util.teststats as under_test
@@ -25,60 +21,6 @@ class NormalizeTestNameTest(unittest.TestCase):
under_test.normalize_test_name("\\home\\user\\test.js"))
-class TestHistoricTestInfo(unittest.TestCase):
- def test_total_test_runtime_not_passing_test_no_hooks(self):
- test_info = under_test.HistoricTestInfo(
- test_name='jstests/test.js',
- num_pass=0,
- avg_duration=0.0,
- hooks=[],
- )
-
- self.assertEqual(0.0, test_info.total_test_runtime())
-
- def test_total_test_runtime_not_passing_test_with_hooks(self):
- test_info = under_test.HistoricTestInfo(
- test_name='jstests/test.js',
- num_pass=0,
- avg_duration=0.0,
- hooks=[
- under_test.HistoricHookInfo(
- hook_id='test:hook',
- num_pass=10,
- avg_duration=5.0,
- ),
- ],
- )
-
- self.assertEqual(0.0, test_info.total_test_runtime())
-
- def test_total_test_runtime_passing_test_no_hooks(self):
- test_info = under_test.HistoricTestInfo(
- test_name='jstests/test.js',
- num_pass=10,
- avg_duration=23.0,
- hooks=[],
- )
-
- self.assertEqual(23.0, test_info.total_test_runtime())
-
- def test_total_test_runtime_passing_test_with_hooks(self):
- test_info = under_test.HistoricTestInfo(
- test_name='jstests/test.js',
- num_pass=10,
- avg_duration=23.0,
- hooks=[
- under_test.HistoricHookInfo(
- hook_id='test:hook',
- num_pass=10,
- avg_duration=5.0,
- ),
- ],
- )
-
- self.assertEqual(28.0, test_info.total_test_runtime())
-
-
class TestHistoricTaskData(unittest.TestCase):
def test_no_hooks(self):
evg_results = [
@@ -138,7 +80,7 @@ class TestHistoricTaskData(unittest.TestCase):
@staticmethod
def _make_evg_result(test_file="dir/test1.js", num_pass=0, duration=0):
return Mock(
- test_name=test_file,
+ test_file=test_file,
task_name="task1",
variant="variant1",
distro="distro1",
@@ -147,53 +89,3 @@ class TestHistoricTaskData(unittest.TestCase):
num_fail=0,
avg_duration_pass=duration,
)
-
- @patch.object(Session, 'get')
- def test_get_stats_from_s3_returns_data(self, mock_get):
- mock_response = MagicMock()
- mock_response.json.return_value = [
- {
- "test_name": "jstests/noPassthroughWithMongod/geo_near_random1.js",
- "num_pass": 74,
- "num_fail": 0,
- "avg_duration_pass": 23.16216216216216,
- "max_duration_pass": 27.123,
- },
- {
- "test_name": "shell_advance_cluster_time:ValidateCollections",
- "num_pass": 74,
- "num_fail": 0,
- "avg_duration_pass": 1.662162162162162,
- "max_duration_pass": 100.0987,
- },
- ]
- mock_get.return_value = mock_response
-
- result = under_test.HistoricTaskData.get_stats_from_s3("project", "task", "variant")
-
- self.assertEqual(result, [
- under_test.HistoricalTestInformation(
- test_name="jstests/noPassthroughWithMongod/geo_near_random1.js",
- num_pass=74,
- num_fail=0,
- avg_duration_pass=23.16216216216216,
- max_duration_pass=27.123,
- ),
- under_test.HistoricalTestInformation(
- test_name="shell_advance_cluster_time:ValidateCollections",
- num_pass=74,
- num_fail=0,
- avg_duration_pass=1.662162162162162,
- max_duration_pass=100.0987,
- ),
- ])
-
- @patch.object(Session, 'get')
- def test_get_stats_from_s3_json_decode_error(self, mock_get):
- mock_response = MagicMock()
- mock_response.json.side_effect = JSONDecodeError("msg", "doc", 0)
- mock_get.return_value = mock_response
-
- result = under_test.HistoricTaskData.get_stats_from_s3("project", "task", "variant")
-
- self.assertEqual(result, [])