requests_mock = <requests_mock.mocker.Mocker object at 0x7fbee1224b70>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fbee1224d68>
sample_archive = '/tmp/pytest-of-jenkins/pytest-0/swh.icinga_plugins.tests.test_deposit0/archive.tar.gz'
sample_metadata = '/tmp/pytest-of-jenkins/pytest-0/swh.icinga_plugins.tests.test_deposit0/metadata.xml'
mocked_time = None
def test_deposit_delays(
requests_mock, mocker, sample_archive, sample_metadata, mocked_time
):
"""Deposit creation passed with some delays, deposit metadata update passed without
delay
"""
scenario = WebScenario()
scenario.add_step(
"post", f"{BASE_URL}/testcol/", ENTRY_TEMPLATE.format(status="deposited")
)
scenario.add_step(
"get", f"{BASE_URL}/testcol/42/status/", status_template(status="verified"),
)
scenario.add_step(
"get", f"{BASE_URL}/testcol/42/status/", status_template(status="loading"),
)
scenario.add_step(
"get", f"{BASE_URL}/testcol/42/status/", status_template(status="done"),
)
# Then metadata update
status_xml = status_template(
status="done",
status_detail="",
swhid="swh:1:dir:02ed6084fb0e8384ac58980e07548a547431cf74",
)
scenario.add_step("get", f"{BASE_URL}/testcol/42/status/", status_xml)
# internal deposit client does call status, then update metadata then status api
scenario.add_step(
"get", f"{BASE_URL}/testcol/42/status/", status_xml,
)
scenario.add_step(
"put", f"{BASE_URL}/testcol/42/atom/", status_xml,
)
scenario.add_step(
"get", f"{BASE_URL}/testcol/42/status/", status_xml,
)
scenario.install_mock(requests_mock)
result = invoke(
[
"--prometheus-exporter",
"--prometheus-exporter-directory",
"/tmp",
"check-deposit",
*COMMON_OPTIONS,
"single",
"--archive",
sample_archive,
"--metadata",
> sample_metadata,
]
)
.tox/py3/lib/python3.7/site-packages/swh/icinga_plugins/tests/test_deposit.py:285:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/icinga_plugins/tests/utils.py:19: in invoke
raise result.exception
.tox/py3/lib/python3.7/site-packages/click/testing.py:408: in invoke
return_value = cli.main(args=args or (), prog_name=prog_name, **extra)
.tox/py3/lib/python3.7/site-packages/click/core.py:1053: in main
rv = self.invoke(ctx)
.tox/py3/lib/python3.7/site-packages/click/core.py:1659: in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
.tox/py3/lib/python3.7/site-packages/click/core.py:1659: in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
.tox/py3/lib/python3.7/site-packages/click/core.py:1395: in invoke
return ctx.invoke(self.callback, **ctx.params)
.tox/py3/lib/python3.7/site-packages/click/core.py:754: in invoke
return __callback(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/click/decorators.py:26: in new_func
return f(get_current_context(), *args, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/icinga_plugins/cli.py:156: in check_deposit_single
sys.exit(DepositCheck(ctx.obj).main())
.tox/py3/lib/python3.7/site-packages/swh/icinga_plugins/deposit.py:36: in __init__
self.register_prometheus_gauge("duration", "seconds", ["stage", "status"])
.tox/py3/lib/python3.7/site-packages/swh/icinga_plugins/base_check.py:109: in register_prometheus_gauge
labelnames=self._get_label_names(labels),
.tox/py3/lib/python3.7/site-packages/prometheus_client/metrics.py:363: in __init__
_labelvalues=_labelvalues,
.tox/py3/lib/python3.7/site-packages/prometheus_client/metrics.py:136: in __init__
registry.register(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <prometheus_client.registry.CollectorRegistry object at 0x7fbee1b64e10>
collector = prometheus_client.metrics.Gauge(swh_e2e_duration_seconds)
def register(self, collector):
"""Add a collector to the registry."""
with self._lock:
names = self._get_names(collector)
duplicates = set(self._names_to_collectors).intersection(names)
if duplicates:
raise ValueError(
'Duplicated timeseries in CollectorRegistry: {0}'.format(
> duplicates))
E ValueError: Duplicated timeseries in CollectorRegistry: {'swh_e2e_duration_seconds'}
.tox/py3/lib/python3.7/site-packages/prometheus_client/registry.py:31: ValueError
TEST RESULT
TEST RESULT
- Run At
- Jan 12 2022, 3:17 PM