neiam
/apollos_crib
It's Apollo's Crib
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
Ship room_pollen and room_drought in the release
db17c28 · Gabriel Morell · 2026-08-11 18:31
Message
{commit_body(@commit)}
Files changed
added
apps/room_sanctum/test/room_sanctum/release_contents_test.exs
+52
−0
@@ -0,0 +1,52 @@
| 1 | +defmodule RoomSanctum.ReleaseContentsTest do | |
| 2 | + @moduledoc """ | |
| 3 | + Every app in the umbrella has to be listed in the release, or it is simply | |
| 4 | + absent from the built image. Nothing fails at compile time -- the crash comes | |
| 5 | + later, in production, when something tries to start a worker from the missing | |
| 6 | + app: | |
| 7 | + | |
| 8 | + ** (ArgumentError) The module RoomPollen.Worker was given as a child to a | |
| 9 | + supervisor but it does not exist | |
| 10 | + | |
| 11 | + That is how room_pollen and room_drought shipped without being deployable. | |
| 12 | + """ | |
| 13 | + use ExUnit.Case, async: true | |
| 14 | + | |
| 15 | + @umbrella_root Path.expand("../../../..", __DIR__) | |
| 16 | + | |
| 17 | + defp umbrella_apps do | |
| 18 | + @umbrella_root | |
| 19 | + |> Path.join("apps") | |
| 20 | + |> File.ls!() | |
| 21 | + |> Enum.filter(&File.dir?(Path.join([@umbrella_root, "apps", &1]))) | |
| 22 | + |> Enum.sort() | |
| 23 | + end | |
| 24 | + | |
| 25 | + defp released_apps do | |
| 26 | + source = File.read!(Path.join(@umbrella_root, "mix.exs")) | |
| 27 | + | |
| 28 | + ~r/^\s*(room_[a-z_]+):\s*:permanent/m | |
| 29 | + |> Regex.scan(source) | |
| 30 | + |> Enum.map(fn [_line, app] -> app end) | |
| 31 | + |> Enum.sort() | |
| 32 | + end | |
| 33 | + | |
| 34 | + test "every umbrella app is included in the release" do | |
| 35 | + missing = umbrella_apps() -- released_apps() | |
| 36 | + | |
| 37 | + assert missing == [], | |
| 38 | + """ | |
| 39 | + These apps exist but are not in the release's applications list in | |
| 40 | + mix.exs, so they will not be in the deployed image: | |
| 41 | + | |
| 42 | + #{Enum.join(missing, "\n ")} | |
| 43 | + """ | |
| 44 | + end | |
| 45 | + | |
| 46 | + test "the release does not name an app that no longer exists" do | |
| 47 | + stale = released_apps() -- umbrella_apps() | |
| 48 | + | |
| 49 | + assert stale == [], | |
| 50 | + "The release lists apps that are not in apps/: #{Enum.join(stale, ", ")}" | |
| 51 | + end | |
| 52 | +end |
modified
mix.exs
+2
−0
@@ -32,6 +32,8 @@ defmodule ApollosCrib.MixProject do
| 32 | 32 | room_treasury: :permanent, |
| 33 | 33 | room_bourse: :permanent, |
| 34 | 34 | room_scribes: :permanent, |
| 35 | + room_pollen: :permanent, | |
| 36 | + room_drought: :permanent, | |
| 35 | 37 | runtime_tools: :permanent |
| 36 | 38 | ] |
| 37 | 39 | ] |
Parents: ae41c81