From 313554d12e6ab3d7d721e3ec3d5ddaed3879f9a6 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 31 Aug 2025 13:44:30 +0200 Subject: [PATCH] test/case: minor, cleanup - Drop redundant comments - Drop redundant imports - PEP-8 fixes Signed-off-by: Joachim Wiberg --- test/case/ietf_system/hostname/hostname.adoc | 2 +- test/case/ietf_system/hostname/test.py | 16 +++++++--------- .../infix_containers/container_basic/test.py | 7 ------- .../infix_containers/container_bridge/test.py | 5 ----- .../case/infix_containers/container_phys/test.py | 5 ----- .../case/infix_containers/container_veth/test.py | 4 ---- 6 files changed, 8 insertions(+), 31 deletions(-) diff --git a/test/case/ietf_system/hostname/hostname.adoc b/test/case/ietf_system/hostname/hostname.adoc index 5ad6db49..69b2e2c9 100644 --- a/test/case/ietf_system/hostname/hostname.adoc +++ b/test/case/ietf_system/hostname/hostname.adoc @@ -26,7 +26,7 @@ endif::topdoc[] . Verify new hostname 'h0stn4m3' . Set hostname to '%h-%m' . Verify hostname is %h-%m in running configuration -. Verify hostname format in operational, according to format +. Verify hostname format in operational <<< diff --git a/test/case/ietf_system/hostname/test.py b/test/case/ietf_system/hostname/test.py index 6b4634da..74f9854b 100755 --- a/test/case/ietf_system/hostname/test.py +++ b/test/case/ietf_system/hostname/test.py @@ -10,8 +10,6 @@ where MAC is the last three bytes of the base MAC address. e.g. ix-01-01-01. """ -import random -import string import re import infamy @@ -20,33 +18,33 @@ with infamy.Test() as test: env = infamy.Env() target = env.attach("target", "mgmt") tgtssh = env.attach("target", "mgmt", "ssh") - fmt = "%h-%m" - new="h0stn4m3" + FMT = "%h-%m" + NEW = "h0stn4m3" with test.step("Set hostname to 'h0stn4m3'"): target.put_config_dict("ietf-system", { "system": { - "hostname": new, + "hostname": NEW, } }) with test.step("Verify new hostname 'h0stn4m3'"): running = target.get_config_dict("/ietf-system:system") - assert running["system"]["hostname"] == new + assert running["system"]["hostname"] == NEW with test.step("Set hostname to '%h-%m'"): target.put_config_dict("ietf-system", { "system": { - "hostname": fmt, + "hostname": FMT, } }) with test.step("Verify hostname is %h-%m in running configuration"): running = target.get_config_dict("/ietf-system:system") - if running["system"]["hostname"] != fmt: + if running["system"]["hostname"] != FMT: test.fail() - with test.step("Verify hostname format in operational, according to format"): + with test.step("Verify hostname format in operational"): cmd = tgtssh.runsh("sed -n s/^DEFAULT_HOSTNAME=//p /etc/os-release") default = cmd.stdout.rstrip() diff --git a/test/case/infix_containers/container_basic/test.py b/test/case/infix_containers/container_basic/test.py index 4415a902..6fce60cd 100755 --- a/test/case/infix_containers/container_basic/test.py +++ b/test/case/infix_containers/container_basic/test.py @@ -1,11 +1,4 @@ #!/usr/bin/env python3 -# -# Verify that a simple web server container can be configured to run -# with host networking, on port 80. Operation is verified using a -# simple GET request for index.html and checking for a key phrase. -# -# The RPC actions: stop + start, and restart are also verified. -# """ Container basic diff --git a/test/case/infix_containers/container_bridge/test.py b/test/case/infix_containers/container_bridge/test.py index 3025f9af..cd9fd4b7 100755 --- a/test/case/infix_containers/container_bridge/test.py +++ b/test/case/infix_containers/container_bridge/test.py @@ -1,9 +1,4 @@ #!/usr/bin/env python3 -# -# Verify connectivity with a simple web server container from behind a -# docker0 bridge. As an added twist, this test also verifies content -# mounts, i.e., custom index.html from running-config. -# """ Container with bridge network diff --git a/test/case/infix_containers/container_phys/test.py b/test/case/infix_containers/container_phys/test.py index fa54f7a8..48964cb3 100755 --- a/test/case/infix_containers/container_phys/test.py +++ b/test/case/infix_containers/container_phys/test.py @@ -1,15 +1,10 @@ #!/usr/bin/env python3 -# -# Verify connectivity with a simple web server container that's been -# given a physical interface instead of an end of a VETH pair. -# """ Container with physical interface Verify connectivity with a simple web server container that's been given a physical interface instead of an end of a VETH pair. """ -import base64 import infamy from infamy.util import until, to_binary diff --git a/test/case/infix_containers/container_veth/test.py b/test/case/infix_containers/container_veth/test.py index f67319c1..408c5bb1 100755 --- a/test/case/infix_containers/container_veth/test.py +++ b/test/case/infix_containers/container_veth/test.py @@ -1,8 +1,4 @@ #!/usr/bin/env python3 -# -# Verify connectivity with a simple web server container from behind a -# regular bridge, a VETH pair connects the container to the bridge. -# r""" Container with VETH pair