@@ -19,6 +19,7 @@ def test_success(tmp_path):
1919 with (tmp_path / "out.prom" ).open ("r" ) as f :
2020 content = f .read ()
2121 assert "test_exit_code 0" in content
22+ assert "test_success 1" in content
2223 assert "test_runtime_seconds" in content
2324 assert "test_success_timestamp_seconds" in content
2425
@@ -35,6 +36,7 @@ def test_failure(tmp_path):
3536 with (tmp_path / "out.prom" ).open ("r" ) as f :
3637 content = f .read ()
3738 assert "test_exit_code 1" in content
39+ assert "test_success 0" in content
3840 assert "test_runtime_seconds" in content
3941 assert "test_success_timestamp_seconds" not in content # Should not be present for failures
4042
@@ -60,6 +62,7 @@ def test_exit_code(tmp_path):
6062 with (tmp_path / "out.prom" ).open ("r" ) as f :
6163 content = f .read ()
6264 assert "test_exit_code 42" in content
65+ assert "test_success 0" in content
6366
6467
6568def test_custom_metrics (tmp_path ):
@@ -89,7 +92,6 @@ def test_custom_metrics(tmp_path):
8992 assert os .path .exists (tmp_path / "out.prom" )
9093 with (tmp_path / "out.prom" ).open ("r" ) as f :
9194 content = f .read ()
92- assert "test_exit_code" in content
9395 assert "test_runtime_seconds" in content
9496 assert "test_script_test_count_total 42" in content
9597 assert 'test_script_test_gauge{mylabel="test"} 23' in content
@@ -140,6 +142,7 @@ def test_extra_labels(tmp_path):
140142 with (tmp_path / "out.prom" ).open ("r" ) as f :
141143 content = f .read ()
142144 assert 'test_exit_code{x="one",y="two"}' in content
145+ assert 'test_success{x="one",y="two"}' in content
143146 assert 'test_runtime_seconds{x="one",y="two"}' in content
144147 assert 'test_script_test_count_total{x="one",y="two"} 42' in content
145148 assert 'test_script_test_gauge{mylabel="test",x="one",y="two"} 23' in content
@@ -170,6 +173,4 @@ def test_argument_passing(tmp_path):
170173 assert os .path .exists (tmp_path / "out.prom" )
171174 with (tmp_path / "out.prom" ).open ("r" ) as f :
172175 content = f .read ()
173- assert "test_exit_code" in content
174- assert "test_runtime_seconds" in content
175176 assert 'test_script_test_count_total{test="--extra"} 1337' in content
0 commit comments