mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-27 16:51:12 -07:00
exthost.ui-delivery: the refusals in the host's words, and the settings
The test held a missing package's page to any status of 400 or more, and the relay's 502 passed it: the host's refusal lost on the way to the panel looked the same as a refusal. It is 404 in the host's words now. The same relay carries a package's settings, which no test asked for through forgectrl: the test reads them, sends a value over its bound, and holds the answer to 400 in the host's words with the stored value unmoved. The edits are inside the test's own function, so no other test's fingerprint moves. Proof: on the bench reference, image 20260922152358, the image's own forgectrl fails the test (a disabled package's page 502, "the extension host did not answer"); with forgectrl 8055000 and this file bind-mounted it passes: 404 "that package is not installed", 404 "this package is disabled: its interface is not served", and 400 '"threshold" is at most 100' with the threshold still 40.
This commit is contained in:
@@ -1857,7 +1857,9 @@ def ui_delivery(ctx):
|
||||
|
||||
st_, why = fc.get("/ext/ui", params={"id": "org.forgetest.nothere"})
|
||||
ev["ui_absent"] = [st_, why]
|
||||
ctx.check(st_ >= 400, "a package that is not installed -> %s %s", st_, why)
|
||||
# The host's refusal in its words, and 404: a 502 here is a relay
|
||||
# that took the host's refusal for no answer.
|
||||
ctx.check(st_ == 404 and "not installed" in json.dumps(why), "a package that is not installed -> %s %s", st_, why)
|
||||
|
||||
# Disabled, it has no page. Disabling a package is the operator's
|
||||
# way out of everything it does, and the interface is part of
|
||||
@@ -1872,6 +1874,21 @@ def ui_delivery(ctx):
|
||||
ctx.check(r.get("ok") is True, "enable -> %s", r.get("error"))
|
||||
st_, doc = fc.get("/ext/ui", params={"id": REF_ID})
|
||||
ctx.check(st_ == 200 and (doc or {}).get("ok"), "enabled again, its page is served -> %s", st_)
|
||||
|
||||
# Its settings come through the same relay, the page's way to them
|
||||
# through the bridge. A value the host refuses is 400 in the host's
|
||||
# words, and what is stored does not move.
|
||||
st_, doc = fc.get("/ext/settings", params={"id": REF_ID})
|
||||
ev["settings"] = [st_, (doc or {}).get("settings")]
|
||||
ctx.check(st_ == 200 and (doc or {}).get("ok") and (doc.get("settings") or {}).get("threshold") == 40,
|
||||
"GET /ext/settings -> %s %s", st_, doc)
|
||||
st_, why = fc.post("/ext/settings", data={"id": REF_ID, "set": json.dumps({"threshold": 101})})
|
||||
ev["settings_refused"] = [st_, why]
|
||||
ctx.log("POST /ext/settings, a threshold over its bound -> %s %s", st_, why)
|
||||
ctx.check(st_ == 400 and "at most 100" in json.dumps(why), "a value the host refuses -> %s %s", st_, why)
|
||||
st_, doc = fc.get("/ext/settings", params={"id": REF_ID})
|
||||
ctx.check(st_ == 200 and ((doc or {}).get("settings") or {}).get("threshold") == 40,
|
||||
"a refused value moved the stored one: %s %s", st_, doc)
|
||||
finally:
|
||||
_put_back(ctx, fc, work, prior, etag, raw, dir_mode)
|
||||
_as_found(ctx, fc, prior, raw, dir_mode, found_tree)
|
||||
|
||||
Reference in New Issue
Block a user