Watch
0
0
Fork
You've already forked hyperhive
0

store_list: pin the mount-refusal and unreachable-store answers too

The script test's stub gains the two remaining rows of bao's table: a
token with no access to the mount (403 on the preflight) and a store that
is not there. Both end with status 2 and an error on stderr, and both must
be errors, not an empty list.
This commit is contained in:
maia 2026-11-24 18:21:43 +01:00
commit 56423beef7

View file

@ -19,7 +19,9 @@ let
# set, and as bao answers a prefix that holds nothing when it is not: status
# 2, `{}`, nothing on stderr. `FAKE_BAO_LIST_DENY` and `FAKE_BAO_LIST_SEALED`
# are the errors, which end with status 2 as well but print on stderr, and
# `FAKE_BAO_LIST_NOISY` is an empty answer with a line on stderr.
# `FAKE_BAO_LIST_NOMOUNT` is a token with no access to the mount,
# `FAKE_BAO_LIST_DOWN` a store that is not there, and `FAKE_BAO_LIST_NOISY` is
# an empty answer with a line on stderr.
# `FAKE_BAO_RACE` has another run create the leaf between this one's read and
# its write. `FAKE_BAO_READ_DELAY` holds each read that long and records, in
# `$FAKE_BAO_KV/.peak`, how many reads were in flight with it. Every call is
@ -58,6 +60,8 @@ let
# As bao answers: a refusal and a sealed store end with status 2, the
# error on stderr and nothing on stdout.
[ -z "''${FAKE_BAO_LIST_DENY-}" ] || { printf 'Error listing %s: Code: 403. Errors:\n\n* 1 error occurred:\n\t* permission denied\n' "$4" >&2; exit 2; }
[ -z "''${FAKE_BAO_LIST_NOMOUNT-}" ] || { printf 'Error making API request.\n\nURL: GET http://127.0.0.1:8200/v1/sys/internal/ui/mounts/secret\nCode: 403. Errors:\n\n* preflight capability check returned 403, please ensure client'"'"'s policies grant access to path "secret/"\n' >&2; exit 2; }
[ -z "''${FAKE_BAO_LIST_DOWN-}" ] || { echo 'Get "http://127.0.0.1:8200/v1/sys/internal/ui/mounts/secret": dial tcp 127.0.0.1:8200: connect: connection refused' >&2; exit 2; }
[ -z "''${FAKE_BAO_LIST_SEALED-}" ] || { echo "Error making API request. Code: 503. Errors: * Vault is sealed" >&2; exit 2; }
# An empty answer with something on stderr is not "nothing there".
[ -z "''${FAKE_BAO_LIST_NOISY-}" ] || { echo "fake bao: a warning" >&2; echo '{}'; exit 2; }