mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 19:02:31 +00:00
Add 50 curated OCI app profiles
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
"""Guard Gonic's persistent data paths and first-run listener contract."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class GonicRecipeTests(unittest.TestCase):
|
||||
def test_persistent_paths_and_listener_match_upstream_image(self):
|
||||
"""Both shipped recipes must provide every configured data directory."""
|
||||
for family in ("apps", "curated"):
|
||||
with self.subTest(family=family):
|
||||
template = json.loads(
|
||||
(ROOT / "catalog" / family / "gonic.json")
|
||||
.read_text(encoding="utf-8")
|
||||
)
|
||||
service = template["compose_stack"]["services"][0]["compose"]
|
||||
environment = service["environment"]
|
||||
volume_paths = {
|
||||
volume["container_path"]
|
||||
for volume in template["container_contract"]["volumes"]
|
||||
}
|
||||
preparation_paths = {
|
||||
item["container_path"]
|
||||
for item in template["proxmox"]["installer_profile"]
|
||||
["volume_preparations"]
|
||||
}
|
||||
compose_volumes = set(service["volumes"])
|
||||
|
||||
expected_paths = {"/data", "/music", "/podcasts", "/playlists", "/cache"}
|
||||
self.assertTrue(expected_paths <= volume_paths)
|
||||
self.assertTrue(expected_paths <= preparation_paths)
|
||||
self.assertTrue({
|
||||
"./data:/data",
|
||||
"./music:/music:ro",
|
||||
"./podcasts:/podcasts",
|
||||
"./playlists:/playlists",
|
||||
"./cache:/cache",
|
||||
} <= compose_volumes)
|
||||
self.assertEqual(environment["GONIC_PODCAST_PATH"], "/podcasts")
|
||||
self.assertEqual(environment["GONIC_PLAYLISTS_PATH"], "/playlists")
|
||||
music = next(
|
||||
volume for volume in template["container_contract"]["volumes"]
|
||||
if volume["container_path"] == "/music"
|
||||
)
|
||||
self.assertTrue(music["read_only"])
|
||||
self.assertEqual(template["container_contract"]["ports"][0]["container_port"], 80)
|
||||
self.assertEqual(template["container_contract"]["ports"][0]["published_example"], 4747)
|
||||
self.assertEqual(template["first_run"]["endpoints"][0]["port"], 80)
|
||||
self.assertEqual(
|
||||
template["proxmox"]["installer_profile"]["startup_healthcheck"]["port"],
|
||||
80,
|
||||
)
|
||||
original = template["container_contract"]["original_compose"]
|
||||
for volume in compose_volumes:
|
||||
self.assertIn(f"- {volume}", original)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,48 @@
|
||||
"""Guard GoToSocial's database configuration and persistent SQLite path."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class GoToSocialRecipeTests(unittest.TestCase):
|
||||
def test_sqlite_database_is_configured_in_both_recipes(self):
|
||||
for family in ("apps", "curated"):
|
||||
with self.subTest(family=family):
|
||||
template = json.loads(
|
||||
(ROOT / "catalog" / family / "gotosocial.json")
|
||||
.read_text(encoding="utf-8")
|
||||
)
|
||||
service = template["compose_stack"]["services"][0]["compose"]
|
||||
environment = service["environment"]
|
||||
self.assertEqual(environment["GTS_DB_TYPE"], "sqlite")
|
||||
self.assertEqual(
|
||||
environment["GTS_DB_ADDRESS"],
|
||||
"/gotosocial/storage/sqlite.db",
|
||||
)
|
||||
|
||||
storage_path = "/gotosocial/storage"
|
||||
self.assertIn(
|
||||
storage_path,
|
||||
{
|
||||
volume["container_path"]
|
||||
for volume in template["container_contract"]["volumes"]
|
||||
},
|
||||
)
|
||||
self.assertIn(
|
||||
"./data:/gotosocial/storage",
|
||||
service["volumes"],
|
||||
)
|
||||
|
||||
original = template["container_contract"]["original_compose"]
|
||||
self.assertIn("GTS_DB_TYPE: sqlite", original)
|
||||
self.assertIn(
|
||||
"GTS_DB_ADDRESS: /gotosocial/storage/sqlite.db",
|
||||
original,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -49,6 +49,13 @@ class RecreationCatalogTests(unittest.TestCase):
|
||||
self.assertEqual(candidate['template']['catalog_ui']['title']['en_US'],
|
||||
catalog.compose('chromium')['catalog_ui']['title']['en_US'])
|
||||
|
||||
def test_curated_only_index_entry_has_internal_template_id(self):
|
||||
catalog = Catalog(ROOT)
|
||||
self.assertFalse((ROOT / 'catalog' / 'apps' / 'it-tools.json').exists())
|
||||
item = next(item for item in catalog._curated_items({}) if item['id'] == 'it-tools')
|
||||
self.assertEqual(item['template_id'], 'image-it-tools')
|
||||
self.assertIsNone(item['template'])
|
||||
|
||||
def test_navidrome_baseurl_is_optional(self):
|
||||
catalog = Catalog(ROOT)
|
||||
template = catalog.compose('navidrome')
|
||||
|
||||
Reference in New Issue
Block a user