mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 13:57:43 +00:00
revert(prometheus): stop making a vhost without a backend probe one
b64e4a0558gave web-svc-mirror the shared monitoring include so it would appear in the scrape set. That include ends in two locations proxying to the role's own backend, and this role runs no container: it renders a vhost and nothing else. Every deploy that reached its vhost then died in resolve_upstream, twenty-one jobs of one CI run, in both the compose and the swarm phrasing of the same message. What followed was worse than the original gap.514a1fe74bguarded the probe inside healthz.conf.j2, which ninety-six roles render, so a one-role want became a change to shared infrastructure. Three further attempts sharpened that guard, none of them fixed the deploy, and the renders I offered as proof were vacuous: the outer integration guard short-circuited in the context I tested, so the block I was measuring had never rendered. main does not carry the include, cannot reach that code path, and does not fail. The complaint that started this, that mirror carries no app="web-svc-mirror" label, does not appear in the run preceding the include either. It was not a regression and not urgent, and it did not justify touching a template every monitored vhost depends on. So the tree returns to main for both files and the lookup written to support them is deleted. Mirror is unscraped again, which is how it has always been, and now a decision to take deliberately rather than a defect invented from a passing remark in a job log. Measured: both templates are byte-identical to main, nothing references the deleted lookup, and the ansible lint suite passes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ac77d52a57
commit
e71e333b12
4 files changed
-151
No files matched your search
@@ -1,64 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
from . import PROJECT_ROOT # noqa: F401
|
||||
|
||||
|
||||
class _DummyTemplar:
|
||||
def __init__(self, available_vars: dict):
|
||||
self.available_variables = available_vars
|
||||
|
||||
|
||||
class ProbeableBackendTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.lookup = lookup_loader.get("probeable_backend")
|
||||
self.lookup._templar = _DummyTemplar({})
|
||||
self.lookup._loader = mock.MagicMock()
|
||||
|
||||
def _run(self, terms, applications: dict, **vars_):
|
||||
class _StubApplications:
|
||||
def run(self, terms_, variables=None, **kw):
|
||||
return [applications]
|
||||
|
||||
with patch.object(lookup_loader, "get", return_value=_StubApplications()):
|
||||
return self.lookup.run(terms, variables=vars_)
|
||||
|
||||
def test_a_role_without_any_port_has_nothing_to_probe(self) -> None:
|
||||
apps = {"web-svc-mirror": {"services": {"mirror": {}}}}
|
||||
|
||||
self.assertEqual(self._run(["web-svc-mirror"], apps), [False])
|
||||
|
||||
def test_a_local_port_is_probeable(self) -> None:
|
||||
apps = {
|
||||
"web-app-foo": {"services": {"foo": {"ports": {"local": {"http": 8080}}}}}
|
||||
}
|
||||
|
||||
self.assertEqual(self._run(["web-app-foo"], apps), [True])
|
||||
|
||||
def test_an_internal_port_alone_is_probeable(self) -> None:
|
||||
apps = {
|
||||
"web-app-foo": {
|
||||
"services": {"foo": {"ports": {"internal": {"http": 8008}}}}
|
||||
}
|
||||
}
|
||||
|
||||
self.assertEqual(
|
||||
self._run(["web-app-foo"], apps),
|
||||
[True],
|
||||
"swarm resolves the upstream from the internal port, so a role "
|
||||
"carrying only that one still has a backend to probe",
|
||||
)
|
||||
|
||||
def test_a_port_the_role_resolved_itself_counts(self) -> None:
|
||||
apps = {"web-app-foo": {"services": {"foo": {}}}}
|
||||
|
||||
self.assertEqual(self._run(["web-app-foo"], apps, http_port="8021"), [True])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user