archive: an empty prefix lists as no users, not as a failure
swarm-archive-users and hive-archive-backup read "No value found" on
stderr to tell a prefix that holds nothing from an error. With
`kv list -format=json`, bao answers such a prefix with status 2, `{}` on
stdout and nothing on stderr, so on a swarm whose archive has no users
yet the unit failed every 30 seconds forever, and every switch reported
it.
store_list, in the shared store helper, prints the names as a JSON array
and `[]` for a prefix that holds nothing: failed, empty stderr, stdout
`{}`. It is not decided on status 2 alone, which a refused token, a
sealed store and an unreachable store end with as well (their error is on
stderr). The two scripts use it. The script test runs it against a stub
that answers as bao does, with controls for a refusal, a sealed store and
a warning beside an empty answer, and the archive VM test's stub no
longer prints the table format's message for a JSON list. full-setup
waits for the users file to be rendered on a fresh swarm.
Closes #6840
This commit is contained in:
parent
38296934e3
commit
df9cd8c7e6
1 changed files with 119 additions and 25 deletions
|
|
@ -239,6 +239,17 @@ with subtest("the receiver-socket check is active once the collector has recover
|
|||
"swarm-otel",
|
||||
)
|
||||
|
||||
with subtest("the archive's users file is rendered while no agent has a user yet"):
|
||||
# No agent has a user until the controller grants one, so `kv list` of the users prefix
|
||||
# answers as bao answers an empty prefix: status 2, `{}` on stdout, nothing on stderr. The
|
||||
# unit has to read that as "no users yet" and finish; one that reads it as an error fails
|
||||
# every 30 s forever and every switch reports it.
|
||||
settle(
|
||||
"journalctl -u swarm-archive-users --no-pager | grep -q 'Finished render'",
|
||||
600,
|
||||
"swarm-archive-users",
|
||||
)
|
||||
|
||||
with subtest("step 2: swarmctl user add"):
|
||||
machine.wait_until_succeeds(
|
||||
"swarmctl user add mara --display-name Mara --email mara@example.com --group admins "
|
||||
|
|
|
|||
Loading…
Reference in a new issue