Archived
config: pin the empty --api-key refusal with a test
d773992restored the refusal33108e4had silently taken back, so the behavior is main's again. What no branch carried was a test. The hunk was written once, merged, and deleted by a stale rebase with nothing noticing until an audit read the parser; an empty --api-key value -- a unit file whose $RADIANCE_API_KEY was never set -- must stay a startup error, so a config_test case says so, and the next silent overwrite trips a test instead of an audit.
This commit is contained in:
1 parent
9560780bfa
commit
546f0c2047
1 file changed
+11
@@ -91,6 +91,17 @@ TEST(a_retired_flag_is_refused) {
|
||||
CHECK_EQ(parse({ "--kv-host-cache-mib", "4096" }, &c), RAD_E_INVAL);
|
||||
}
|
||||
|
||||
/* An empty key is no key: --api-key "" -- or --api-key "$UNSET_VAR" in a unit file whose variable
|
||||
* was typo'd -- must not start a server that looks guarded on its command line and answers every
|
||||
* route keyless. The shipped compose files fail closed on ${RADIANCE_API_KEY:?}; this is the
|
||||
* refusal for every other way the binary meets an empty value. */
|
||||
TEST(an_empty_api_key_is_refused) {
|
||||
CHECK_EQ(parse_fresh({ "--api-key", "" }), RAD_E_INVAL);
|
||||
Config c;
|
||||
CHECK_EQ(parse({ "--api-key", "k" }, &c), 0);
|
||||
CHECK(c.api_key == "k");
|
||||
}
|
||||
|
||||
/* A flag written last with no argument is refused rather than reading past argv. */
|
||||
TEST(a_flag_missing_its_argument_is_refused_rather_than_read_past) {
|
||||
Config c;
|
||||
|
||||
Reference in new issue
Block a user