Skip to content

Commit 5af269d

Browse files
committed
Fix: Improve comments in test_snmp_provider.
1 parent 8797846 commit 5af269d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/e2e_tests/test_snmp_provider.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
save_failure_artifacts,
1414
)
1515

16-
# Constants
16+
1717
KEEP_UI_URL = "http://localhost:3000"
1818
DEFAULT_SNMP_PORT = 1605 # Using a non-privileged port for testing
1919
DOCKER_NETWORK = "keep_default" # Default network for Keep services
@@ -205,10 +205,9 @@ def test_snmp_provider(browser: Page, setup_page_logging, failure_artifacts):
205205
# Close the provider details
206206
browser.get_by_role("button", name="Cancel", exact=True).click()
207207

208-
# Send test SNMP traps
209208
print("Sending test SNMP traps...")
210209

211-
# Get a list of all containers and find the backend container
210+
# Dynamically find the Keep backend container
212211
container_list = subprocess.run(
213212
["docker", "ps", "--format", "{{.Names}}"],
214213
capture_output=True,
@@ -217,6 +216,7 @@ def test_snmp_provider(browser: Page, setup_page_logging, failure_artifacts):
217216
containers = container_list.stdout.strip().split('\n')
218217
backend_container = None
219218

219+
# Find any container with 'keep-backend' in its name
220220
for container in containers:
221221
if 'keep-backend' in container:
222222
backend_container = container
@@ -227,13 +227,14 @@ def test_snmp_provider(browser: Page, setup_page_logging, failure_artifacts):
227227

228228
print(f"Found backend container: {backend_container}")
229229

230+
# Get the IP address of the backend container within the Docker network
230231
keep_backend_ip = subprocess.run(
231232
["docker", "inspect", "-f", "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}", backend_container],
232233
capture_output=True,
233234
text=True
234235
)
236+
# Extract the IP address and use it as the target for SNMP traps
235237
host = keep_backend_ip.stdout.strip()
236-
# Send a trap
237238
send_snmp_trap(host=host, port=snmp_port)
238239

239240
# Wait for the trap to be processed

0 commit comments

Comments
 (0)