summaryrefslogtreecommitdiffhomepage
path: root/test/unit
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2024-07-03 17:43:20 +0100
committerAndrew Clayton <a.clayton@nginx.com>2024-07-12 16:44:54 +0100
commitf4ba4b5583cef182ad29cc158e8b1e2965b09829 (patch)
tree21ba2d65b1461d85749da55257b227d657326db8 /test/unit
parent707f4ef821f82eb772728f687e41afc9d6945f98 (diff)
downloadunit-f4ba4b5583cef182ad29cc158e8b1e2965b09829.tar.gz
unit-f4ba4b5583cef182ad29cc158e8b1e2965b09829.tar.bz2
tests: Fix `/status' endpoint tests for new 'modules' section
Now that the `/status` endpoint returns a list of loaded language modules, e.g { "modules": { "python": { "version": "3.12.2", "lib": "/opt/unit/modules/python.unit.so" }, ... ... } This broke 'test/test_status.py' in a number of ways 1) The check for all the object values being 0 at startup is no longer true with the modules section. 2) The find_diffs() check broke trying to subtract strings from strings. So don't include the 'modules' section in the check_zeros() check and in the find_diffs() check, if we're dealing with strings do a basic compare returning that value instead. [ Commit message - Andrew ] Co-developed-by: Andrew Clayton <a.clayton@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/status.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/unit/status.py b/test/unit/status.py
index 95096a96..d8bb4e41 100644
--- a/test/unit/status.py
+++ b/test/unit/status.py
@@ -6,16 +6,16 @@ class Status:
control = Control()
def _check_zeros():
- assert Status.control.conf_get('/status') == {
- 'connections': {
+ status = Status.control.conf_get('/status')
+
+ assert status['connections'] == {
'accepted': 0,
'active': 0,
'idle': 0,
'closed': 0,
- },
- 'requests': {'total': 0},
- 'applications': {},
}
+ assert status['requests'] == {'total': 0}
+ assert status['applications'] == {}
def init(status=None):
Status._status = (
@@ -31,6 +31,9 @@ class Status:
if k in d2
}
+ if isinstance(d1, str):
+ return d1 == d2
+
return d1 - d2
return find_diffs(Status.control.conf_get('/status'), Status._status)