mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
The base image postgis/postgis:17-3.5 is Debian 11, whose archive was decommissioned on 2026-08-31. The pgvector layer pulled 174 MB of build toolchain from deb.debian.org, and those pool files are now purged while the index still advertises them: linux-libc-dev 404'd on 44 of 44 attempts across four Fastly POPs. Since 2026-09-07 the suite's InRelease is also expired, so apt-get update itself exits 100. PGDG ships postgresql-17-pgvector prebuilt and its bullseye-pgdg suite is alive, so reading only the pgdg.list the image writes itself removes deb.debian.org from the build entirely. Verified on the exact mirrored base image: the package installs, vector.so lands, zero bytes fetched from deb.debian.org. Signature verification is untouched - no Acquire::Check-Valid-Until. Side effect worth naming: the old recipe cloned pgvector.git with no tag or ref, so every rebuild baked unpinned master into the central RDBMS. It is now pinned at 0.8.6-1.pgdg11+1. The base image is still EOL and its migration remains open. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
76 lines
2.3 KiB
Python
76 lines
2.3 KiB
Python
"""Unit tests for ``plugins/lookup/postgres_libraries.py``."""
|
|
|
|
import importlib.util
|
|
import unittest
|
|
|
|
from ansible.errors import AnsibleError
|
|
|
|
from . import PROJECT_ROOT
|
|
|
|
|
|
def _load_module(rel_path: str, name: str):
|
|
path = PROJECT_ROOT / rel_path
|
|
spec = importlib.util.spec_from_file_location(name, str(path))
|
|
mod = importlib.util.module_from_spec(spec)
|
|
assert spec and spec.loader
|
|
spec.loader.exec_module(mod)
|
|
return mod
|
|
|
|
|
|
class PostgresLibrariesLookupTests(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.mod = _load_module(
|
|
"plugins/lookup/postgres_libraries.py",
|
|
"lookup_postgres_libraries",
|
|
)
|
|
|
|
def _run(self, terms):
|
|
lookup = self.mod.LookupModule()
|
|
return lookup.run(terms)
|
|
|
|
def test_zero_terms_raises(self):
|
|
with self.assertRaises(AnsibleError):
|
|
self._run([])
|
|
|
|
def test_two_terms_raises(self):
|
|
with self.assertRaises(AnsibleError):
|
|
self._run([["vector"], "extra"])
|
|
|
|
def test_non_list_first_term_raises(self):
|
|
with self.assertRaises(AnsibleError):
|
|
self._run(["vector"])
|
|
|
|
def test_empty_extension_list_returns_empty(self):
|
|
result = self._run([[]])
|
|
self.assertEqual(result, [[]])
|
|
|
|
def test_extension_in_registry_returns_recipe(self):
|
|
result = self._run([["vector"]])[0]
|
|
self.assertEqual(len(result), 1)
|
|
self.assertEqual(result[0]["extension"], "vector")
|
|
self.assertEqual(result[0]["name"], "pgvector")
|
|
self.assertEqual(result[0]["apt_package"], "pgvector")
|
|
|
|
def test_base_extensions_are_filtered_out(self):
|
|
result = self._run([["bloom", "postgis", "pg_trgm", "unaccent"]])[0]
|
|
self.assertEqual(result, [])
|
|
|
|
def test_mixed_extensions_returns_only_non_base(self):
|
|
result = self._run([["bloom", "vector", "postgis"]])[0]
|
|
self.assertEqual(len(result), 1)
|
|
self.assertEqual(result[0]["extension"], "vector")
|
|
|
|
def test_duplicates_are_deduplicated(self):
|
|
result = self._run([["vector", "vector"]])[0]
|
|
self.assertEqual(len(result), 1)
|
|
|
|
def test_blanks_are_skipped(self):
|
|
result = self._run([["", " ", "vector"]])[0]
|
|
self.assertEqual(len(result), 1)
|
|
self.assertEqual(result[0]["extension"], "vector")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|