Skip to main content

Module mock_door

Module mock_door 

Source
Expand description

Behaviour 63’s guard: did the mock actually HEAR this run?

terraform’s UpCloud provider reaches a mock only through its undocumented UPCLOUD_DEBUG_API_BASE_URL. A provider release that drops that knob sends a “mock” apply or destroy to THE ACCOUNT — with whatever token the shell carried. The guard (lane T13’s ledger, behaviour 63; lane T14 wires it):

  1. a mock run presents a token minted for THIS run (mint_token) — never a token of the account, so a provider that ignored the knob is refused by the account with a 401 instead of acting;
  2. before apply/destroy, a read-only step (a plan) runs with it;
  3. require_heard asks the mock’s /mock/heard door whether that token’s requests — and a GET /1.3/account among them — arrived. Zero is a refusal by name: the provider spoke to somebody, and it was not the mock.

Structs§

Heard
What the mock heard from one token.

Functions§

heard
Ask the mock at endpoint what it heard from token. The account has no such door: asking it is a programming error, refused by name.
mint_token
A bearer for ONE mock run: ucat_mock_<pid>_<nanos>. It is not a secret; it is a name the mock can hear.
require_heard
Refuse what unless the mock heard token, including a GET /1.3/account. Ok carries what was heard, for the transcript.