-
Notifications
You must be signed in to change notification settings - Fork 154
Add test for configure and fix flaky tests #855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import subprocess | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from sys import platform | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -96,7 +97,7 @@ def test_ssh_to_linode_and_get_kernel_version( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--text", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--no-headers", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).strip() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| time.sleep(SSH_SLEEP_PERIOD) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -129,16 +130,31 @@ def test_check_vm_for_ipv4_connectivity( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--text", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--no-headers", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| time.sleep(SSH_SLEEP_PERIOD) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| output = os.popen( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "linode-cli ssh root@" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + linode_label | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + " -i " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + privkey_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + ' -o StrictHostKeyChecking=no -o IdentitiesOnly=yes "ping -4 -W60 -c3 google.com"' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).read() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert "0% packet loss" in output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).strip() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ssh_cmd = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "linode-cli", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "ssh", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"root@{linode_label}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "-i", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| privkey_file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "-o", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "StrictHostKeyChecking=no", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "-o", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "IdentitiesOnly=yes", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "ping -4 -W60 -c3 google.com", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| output = "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for attempt in range(NUM_OF_RETRIES): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result = subprocess.run( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ssh_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| output = result.stdout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if "0% packet loss" in output: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| time.sleep(10) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| time.sleep(10) | |
| if attempt < NUM_OF_RETRIES - 1: | |
| time.sleep(10) |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion message includes the output, but doesn't include which attempt failed or any stderr output from the subprocess. Consider including result.stderr in the assertion message to help debug SSH connection failures. The stderr would show SSH errors like connection refused, authentication failures, etc.
| for attempt in range(NUM_OF_RETRIES): | |
| result = subprocess.run( | |
| ssh_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True | |
| ) | |
| output = result.stdout | |
| if "0% packet loss" in output: | |
| break | |
| time.sleep(10) | |
| assert ( | |
| "0% packet loss" in output | |
| ), f"Ping failed after {NUM_OF_RETRIES} retries: {output}" | |
| stderr_output = "" | |
| last_attempt = 0 | |
| for attempt in range(NUM_OF_RETRIES): | |
| result = subprocess.run( | |
| ssh_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True | |
| ) | |
| output = result.stdout | |
| stderr_output = result.stderr | |
| last_attempt = attempt + 1 | |
| if "0% packet loss" in output: | |
| break | |
| time.sleep(10) | |
| assert ( | |
| "0% packet loss" in output | |
| ), ( | |
| f"Ping failed after {NUM_OF_RETRIES} retries " | |
| f"(last attempt {last_attempt}): stdout: {output}, stderr: {stderr_output}" | |
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop variable 'attempt' is unused. Consider using '_' to indicate that this variable is intentionally not used, or use 'attempt' in error messages or logging to provide better debugging information.