Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 25 additions & 27 deletions providers/base/bin/wifi_client_test_netplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,12 @@ def perform_ping_test(interface, renderer):
count = 5
result = ping(target, interface, count, 10)
print("Ping result: {}".format(result))
if result["received"] == result["transmitted"]:
return True

return False
if result["received"] != result["transmitted"]:
raise ValueError(
"{} packets expected but only {} received".format(
count, result["received"]
)
)


def print_journal_entries(start, renderer):
Expand Down Expand Up @@ -491,29 +493,25 @@ def main():
renderer = check_and_get_renderer(args.renderer)
args.renderer = renderer

with handle_original_np_config():
with handle_test_np_config(args):
print_head("Wait for interface to be routable")
reached_routable = wait_for_routable(args.interface, renderer)

test_result = False
if reached_routable:
print_head("Display address")
print_address_info(args.interface)

print_head("Display route table")
print_route_info()

# Check connection by ping or link status
print_head("Perform a ping test")
test_result = perform_ping_test(args.interface, renderer)
if test_result:
print("Connection test passed\n")
else:
print("Connection test failed\n")
print_journal_entries(start_time, renderer)
if not test_result:
raise SystemExit(1)
try:
with handle_original_np_config():
with handle_test_np_config(args):
print_head("Wait for interface to be routable")
reached_routable = wait_for_routable(args.interface, renderer)

test_result = False
if reached_routable:
print_head("Display address")
print_address_info(args.interface)

print_head("Display route table")
print_route_info()

# Check connection by ping or link status
print_head("Perform a ping test")
perform_ping_test(args.interface, renderer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see here, we don't have a clear status when the test is successful: "Connection test passed\n" isn't printed anymore.

finally:
print_journal_entries(start_time, renderer)


if __name__ == "__main__":
Expand Down
Loading