|
|
|
|
@ -24,6 +24,16 @@ def host_snapshot():
|
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def stable_snapshot(value): |
|
|
|
|
# DHCP lifetime и route cache age меняются от часов, без изменения конфигурации. |
|
|
|
|
if isinstance(value, dict): |
|
|
|
|
return {key: stable_snapshot(item) for key, item in value.items() |
|
|
|
|
if key not in {"valid_life_time", "preferred_life_time", "expires", "used", "lastuse"}} |
|
|
|
|
if isinstance(value, list): |
|
|
|
|
return [stable_snapshot(item) for item in value] |
|
|
|
|
return value |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def inside(args): |
|
|
|
|
def interrupted(signum, _frame): |
|
|
|
|
raise KeyboardInterrupt(f"signal {signum}") |
|
|
|
|
@ -97,7 +107,7 @@ def main():
|
|
|
|
|
status = child.wait() |
|
|
|
|
after = host_snapshot() |
|
|
|
|
(directory / "host-after.json").write_text(json.dumps(after, indent=2) + "\n") |
|
|
|
|
unchanged = before == after and os.readlink("/proc/self/ns/net") == original_namespace |
|
|
|
|
unchanged = stable_snapshot(before) == stable_snapshot(after) and os.readlink("/proc/self/ns/net") == original_namespace |
|
|
|
|
(directory / "host-check.json").write_text(json.dumps({"unchanged": unchanged}, indent=2) + "\n") |
|
|
|
|
if not unchanged: |
|
|
|
|
print("FAIL: main network namespace snapshot changed during the run", file=sys.stderr) |
|
|
|
|
|