mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
confserver: In protocol V2, a "load" should only send back changes not all items
This commit is contained in:
parent
02802a5113
commit
6897dab2de
@ -97,3 +97,4 @@ These error messages are intended to be human readable, not machine parseable.
|
||||
### Protocol Version Changes
|
||||
|
||||
* V2: Added the `visible` key to the response. Invisible items are no longer represented as having value null.
|
||||
* V2: `load` now sends changes compared to values before the load, not the whole list of config items.
|
||||
|
@ -84,7 +84,11 @@ def run_server(kconfig, sdkconfig, default_version=MAX_PROTOCOL_VERSION):
|
||||
before_ranges = get_ranges(config)
|
||||
before_visible = get_visible(config)
|
||||
|
||||
if "load" in req: # if we're loading a different sdkconfig, response should have all items in it
|
||||
if "load" in req: # load a new sdkconfig
|
||||
|
||||
if req.get("version", default_version) == 1:
|
||||
# for V1 protocol, send all items when loading new sdkconfig.
|
||||
# (V2+ will only send changes, same as when setting an item)
|
||||
before = {}
|
||||
before_ranges = {}
|
||||
before_visible = {}
|
||||
|
@ -64,11 +64,6 @@ def main():
|
||||
|
||||
test_load_save(p, temp_sdkconfig_path)
|
||||
|
||||
p.send("%s\n" % json.dumps({"version": 2, "load": temp_sdkconfig_path}))
|
||||
load_result = expect_json(p)
|
||||
print("Load result: %s" % (json.dumps(load_result)))
|
||||
assert len(load_result["values"]) > 0 # loading same file should return all config items
|
||||
assert len(load_result["ranges"]) > 0
|
||||
print("Done. All passed.")
|
||||
|
||||
finally:
|
||||
@ -133,6 +128,13 @@ def test_load_save(p, temp_sdkconfig_path):
|
||||
after = os.stat(temp_sdkconfig_path).st_mtime
|
||||
assert after > before # something got written to disk
|
||||
|
||||
# Do a V2 load
|
||||
load_result = send_request(p, {"version": 2, "load": temp_sdkconfig_path})
|
||||
print("V2 Load result: %s" % (json.dumps(load_result)))
|
||||
assert "error" not in load_result
|
||||
assert len(load_result["values"]) == 0 # in V2, loading same file should return no config items
|
||||
assert len(load_result["ranges"]) == 0
|
||||
|
||||
# Do a V1 load
|
||||
load_result = send_request(p, {"version": 1, "load": temp_sdkconfig_path})
|
||||
print("V1 Load result: %s" % (json.dumps(load_result)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user