Shemot 16: dvar yom b'yomo, and on the sixth day double, and none on the seventh. Every night at 00:00Z the day's provision went stale and the readiness probe failed until someone woke — 13.5 hours on 2026-10-15. CronJob `manna` (deploy/k8s/manna-cronjob.yaml) runs at 00:01Z Sunday to Friday in our own korban-processor image, mounts the manna PVC as the app's uid, and writes today.json from the ConfigMap's MANNA_* amounts — doubled on Friday, valid to Sunday 00:30Z. The pipeline now accepts Friday's `double` on Saturday (validate_date/3) and nothing else across a day boundary; three tests. The kohen sets the amounts, may still write by hand, and reads a failed job as the Day-4 alarm (KOHEN "The manna, each morning"; Tamid §1.1). Doorpost re-pinned. Elixir green. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
37 lines
1.7 KiB
Elixir
37 lines
1.7 KiB
Elixir
defmodule VavPipeline.MannaShabbatTest do
|
||
@moduledoc "Shemot 16:22–26: Friday's double portion is the Shabbat's too; nothing else crosses the day boundary."
|
||
use ExUnit.Case, async: false
|
||
alias VavPipeline.Manna
|
||
|
||
@friday ~D[2026-10-16]
|
||
@saturday ~D[2026-10-17]
|
||
@sunday ~D[2026-10-18]
|
||
|
||
defp write(date, type, expires) do
|
||
path = Manna.provision_file()
|
||
File.mkdir_p!(Path.dirname(path))
|
||
File.write!(path, Jason.encode!(%{"date" => Date.to_iso8601(date), "provision" => %{"compute_units" => 2000, "memory_mb" => 1, "api_calls_external" => 1, "storage_delta_mb" => 1, "sanhedrin_panels_max" => 1}, "type" => type, "expires_at" => expires, "written_by" => "test", "written_at" => "2026-10-16T00:01:00Z"}))
|
||
on_exit(fn -> File.rm(path) end)
|
||
end
|
||
|
||
defp at(date, h), do: DateTime.new!(date, Time.new!(h, 0, 0), "Etc/UTC")
|
||
|
||
test "Friday's double stands on Saturday" do
|
||
write(@friday, "double", "2026-10-18T00:30:00Z")
|
||
assert {:ok, %{type: :double}} = Manna.check_at(at(@friday, 12))
|
||
assert {:ok, %{type: :double}} = Manna.check_at(at(@saturday, 12))
|
||
end
|
||
|
||
test "a regular provision does not cross the boundary; a double does not reach Sunday" do
|
||
write(@friday, "regular", "2026-10-18T00:30:00Z")
|
||
assert {:error, "MANNA_STALE" <> _} = Manna.check_at(at(@saturday, 12))
|
||
write(@friday, "double", "2026-10-19T00:30:00Z")
|
||
assert {:error, "MANNA_STALE" <> _} = Manna.check_at(at(@sunday, 12))
|
||
end
|
||
|
||
test "a double written on a Thursday does not carry to Friday — only Shabbat receives it" do
|
||
write(~D[2026-10-15], "double", "2026-10-17T00:30:00Z")
|
||
assert {:error, "MANNA_STALE" <> _} = Manna.check_at(at(@friday, 12))
|
||
end
|
||
end
|