Skip to content

Commit b854206

Browse files
committed
Address review comments from PR #1544
1 parent a532c98 commit b854206

6 files changed

Lines changed: 20 additions & 12 deletions

File tree

docs/docker-troubleshooting/arp-flux-sysctls.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Set these sysctls at container runtime.
3838
--sysctl net.ipv4.conf.all.arp_ignore=1 \
3939
--sysctl net.ipv4.conf.all.arp_announce=2 \
4040
ghcr.io/netalertx/netalertx:latest
41-
41+
```
42+
4243
> **Note:** Setting `net.ipv4.conf.all.arp_ignore` and `net.ipv4.conf.all.arp_announce` may fail with "operation not permitted" unless the container is run with elevated privileges. To resolve this, you can:
4344
> - Use `--privileged` with `docker run`.
4445
> - Use the more restrictive `--cap-add=NET_ADMIN` (or `cap_add: [NET_ADMIN]` in `docker-compose` service definitions) to allow the sysctls to be applied at runtime.

install/production-filesystem/entrypoint.d/36-override-individual-settings.sh

100644100755
File mode changed.

install/production-filesystem/entrypoint.d/37-host-optimization.sh

100644100755
File mode changed.

test/api_endpoints/test_devices_endpoints.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,14 @@ def test_devices_by_status(client, api_token, test_mac):
195195

196196
# 3. Check favorite formatting if devFavorite = 1
197197
# Update dummy device to favorite
198-
client.post(
198+
update_resp = client.post(
199199
f"/device/{test_mac}",
200200
json={"devFavorite": 1},
201201
headers=auth_headers(api_token)
202202
)
203+
assert update_resp.status_code == 200
204+
assert update_resp.json.get("success") is True
205+
203206
resp_fav = client.get("/devices/by-status?status=my", headers=auth_headers(api_token))
204207
fav_data = next((d for d in resp_fav.json if d["id"] == test_mac), None)
205208
assert fav_data is not None

test/api_endpoints/test_mcp_tools_endpoints.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,21 @@ def create_dummy(client, api_token, test_mac):
3030
"devType": "Router",
3131
"devVendor": "TestVendor",
3232
}
33-
client.post(f"/device/{test_mac}", json=payload, headers=auth_headers(api_token))
33+
response = client.post(f"/device/{test_mac}", json=payload, headers=auth_headers(api_token))
34+
assert response.status_code in [200, 201], (
35+
f"Expected status 200/201 for device creation, got {response.status_code}. "
36+
f"Response body: {response.get_data(as_text=True)}"
37+
)
38+
return response
3439

3540

3641
def delete_dummy(client, api_token, test_mac):
37-
client.delete("/devices", json={"macs": [test_mac]}, headers=auth_headers(api_token))
42+
response = client.delete("/devices", json={"macs": [test_mac]}, headers=auth_headers(api_token))
43+
assert response.status_code == 200, (
44+
f"Expected status 200 for device deletion, got {response.status_code}. "
45+
f"Response body: {response.get_data(as_text=True)}"
46+
)
47+
return response
3848

3949

4050
# --- Device Search Tests ---

test/docker_tests/test_entrypoint.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import subprocess
99
import uuid
1010
import pytest
11+
import shutil
1112

1213
IMAGE = "netalertx-test"
1314

@@ -85,7 +86,7 @@ def test_no_app_conf_override_when_no_graphql_port():
8586

8687
def test_skip_startup_checks_env_var():
8788
# If SKIP_STARTUP_CHECKS contains the human-readable name of a check (e.g. "mandatory folders"),
88-
# the entrypoint should skip that specific check. We check that the "Creating NetAlertX log directory."
89+
# the entrypoint should skip that specific check. We check that the "Creating NetAlertX log directory."
8990
# message (from the mandatory folders check) is not printed when skipped.
9091
result = _run_entrypoint(env={"SKIP_STARTUP_CHECKS": "mandatory folders"}, check_only=True)
9192
assert "Creating NetAlertX log directory" not in result.stdout
@@ -94,8 +95,6 @@ def test_skip_startup_checks_env_var():
9495

9596
@pytest.mark.docker
9697
@pytest.mark.feature_complete
97-
def test_host_optimization_warning_matches_sysctl():
98-
"""Validate host-optimization warning matches actual host sysctl values."""
9998
def test_host_optimization_warning_matches_sysctl():
10099
"""Validate host-optimization warning matches actual host sysctl values."""
101100
sysctl_bin = shutil.which("sysctl")
@@ -116,11 +115,6 @@ def test_host_optimization_warning_matches_sysctl():
116115
check=False,
117116
timeout=10,
118117
)
119-
capture_output=True,
120-
text=True,
121-
check=False,
122-
timeout=10,
123-
)
124118

125119
if ignore_proc.returncode != 0 or announce_proc.returncode != 0:
126120
pytest.skip("sysctl values unavailable on host; skipping host-optimization warning check")

0 commit comments

Comments
 (0)