Skip to content

Commit 1a28c76

Browse files
committed
Parameterized log_metrics tests to include timestamp
1 parent 8f53b2b commit 1a28c76

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/functional/test_run_class.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pathlib
1515
import concurrent.futures
1616
import random
17-
17+
import datetime
1818
import simvue
1919
from simvue.api.objects.alert.fetch import Alert
2020
from simvue.exception import SimvueRunError
@@ -59,12 +59,14 @@ def test_run_with_emissions() -> None:
5959

6060

6161
@pytest.mark.run
62+
@pytest.mark.parametrize("timestamp", (datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f"), None), ids=("timestamp", "no_timestamp"))
6263
@pytest.mark.parametrize("overload_buffer", (True, False), ids=("overload", "normal"))
6364
@pytest.mark.parametrize(
6465
"visibility", ("bad_option", "tenant", "public", ["ciuser01"], None)
6566
)
6667
def test_log_metrics(
6768
overload_buffer: bool,
69+
timestamp: str | None,
6870
setup_logging: "CountingLogHandler",
6971
mocker,
7072
request: pytest.FixtureRequest,
@@ -112,9 +114,9 @@ def test_log_metrics(
112114

113115
if overload_buffer:
114116
for i in range(run._dispatcher._max_buffer_size * 3):
115-
run.log_metrics({key: i for key in METRICS})
117+
run.log_metrics({key: i for key in METRICS}, timestamp=timestamp)
116118
else:
117-
run.log_metrics(METRICS)
119+
run.log_metrics(METRICS, timestamp=timestamp)
118120
time.sleep(2.0 if overload_buffer else 1.0)
119121
run.close()
120122
client = sv_cl.Client()

0 commit comments

Comments
 (0)