summaryrefslogtreecommitdiffhomepage
path: root/test (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-09-10tests: Suppress cargo-component outputAndrew Clayton1-1/+4
Suppress the output from cargo-component when we first run it to check if it's available, otherwise you may see the following $ pytest test/test_wasm-wasi-component.py which: no go in (/home/andrew/.local/bin:/home/andrew/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin) error: no such command: `component` View all installed commands with `cargo --list` Find a package to install `component` with `cargo search cargo-component Note: This didn't stop the tests from working, just an aesthetic issue. Closes: https://github.com/nginx/unit/issues/1410 Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-10tests: Fix routing tests in the no njs caseAndrew Clayton1-4/+19
Don't try and run the tests that require njs if it isn't enabled. Closes: https://github.com/nginx/unit/issues/1411 Fixes: 43c4bfdcd ("tests: "if" option in http route match") Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-07java: Update third-party componentsSergey A. Osokin1-1/+1
[ Tweaked subject - Andrew ] Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-08-28test/wasm-wc: Rename test_wasm_component.pyAndrew Clayton1-0/+0
Rename this to 'test_wasm-wasi-component.py' to match the language module name and the name as used in the CI. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-08-28test/wasm-wc: Target wasm32-wasip1Andrew Clayton1-1/+1
Changes are afoot... wasm32-wasi has been renamed wasm32-wasip1, there is also a wasm32-wasip2 (seems not yet fully realised) and wasm32-wasi is being kept clear for an eventual WASI 1.0 release. cargo-component targets wasm32-wasip1 by default and adapts the module to the preview2 version of WASI supported by the component model. This means that the component is now found under target/wasm32-wasip1/... Link: <https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip1.html> Link: <https://github.com/bytecodealliance/cargo-component/blob/main/README.md#wasi-support> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-08-28tests: Fix `/status' endpoint to cater for listsAndrew Clayton1-1/+1
We can now get list objects from the /status endpoint in the case of having different versions of the same language module. That led to this error > return d1 - d2 E TypeError: unsupported operand type(s) for -: 'list' and 'list' We already cover a similar case for when we have simple strings so add this to that. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-08-20Tests: initial "wasm-wasi-component" testAndrei Zeliankou9-1/+283
2024-08-20tests: "if" option in http route matchZhidao HONG1-0/+57
2024-07-12tests: Fix `/status' endpoint tests for new 'modules' sectionAndrei Zeliankou1-5/+8
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>
2024-07-02tests: Add tests for python application factoriesGourav2-0/+163
Add the following tests cases: 1. When "factory" key is used inside the "targets" option. 2. When "factory" key is used at the root level of python application config. 3. When factory returns invalid callable or When factory is invalid callable Link: <https://github.com/nginx/unit/pull/1336> [ Commit subject & message formatting tweaks - Andrew ] Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-06-24Tests: chunked request bodyAndrei Zeliankou2-1/+189
2024-06-07Tests: print unit.log on unsuccessful unmountAndrei Zeliankou1-0/+1
2024-06-07Tests: explicitly specify 'f' prefix to format string before printingAndrei Zeliankou1-1/+1
Otherwise string will be printed as: "Could not unmount filesystems in tmpdir ({temporary_dir})"
2024-05-09tests: REQUEST_URI variable test with rewriteAndrei Zeliankou1-0/+40
2024-05-09tests: Change request_uri tests for changed behaviourGabor Javorszky1-4/+4
2024-05-08java: Update third-party componentsSergey A. Osokin1-1/+1
[ Tweaked subject - Andrew ] Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-04-10Tests: error report corrected for unknown variables in "response_headers"Andrei Zeliankou1-7/+6
For more information please see https://github.com/nginx/unit/pull/1191
2024-04-10Tests: compatibility with OpenSSL 3.2.0Andrei Zeliankou1-1/+5
OpenSSL 3.2.0 generates X.509v3 certificates by default. These certificates, even self-signed, cannot sign other certificates unless "CA:TRUE" is explicitly set in the basicConstraints extension. As a result, tests attempting this are currently failing. Fix is to provide "CA:TRUE" in the basicConstraints for self-signed root certificates used in "openssl ca" commands. Closes: https://github.com/nginx/unit/issues/1202 Tested-by: Andrew Clayton <a.clayton@nginx.com> Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
2024-04-10Tests: added $request_uri tests with proxyAndrei Zeliankou1-1/+100
This patch consist of 3 tests: 1. Ensure that $request_uri won't change while proxying the request. 2. Same as 1, but modifying the request using the "rewrite" directive. 3. Same as 2, but with rewrite containing a percent-encoded string.
2024-03-12Tests: NJS cacheable variables with access logAndrei Zeliankou1-0/+18
Reproduces issue https://github.com/nginx/unit/issues/1169.
2024-02-22Update third-party java components to their recent versionsSergey A. Osokin1-1/+1
Acked-by: Timo Stark <t.stark@nginx.com> [ Remove trailing '.' from subject line - Andrew ] Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-21Tests: renamed test_python_procman.py since it's not Python-specificAndrei Zeliankou1-0/+0
Python applications are used only to generate responses here and can be replaced by applications written in any other language. While the "_python" prefix is used to indicate that the file contains tests specific to the Python module.
2024-02-21Tests: skip some of TLS reconfiguration tests under AddressSanitizerAndrei Zeliankou1-0/+7
These tests cause router crash when run with AddressSanitizer: ================================================================= ==77196==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000079340 at pc 0x55d56b132d4b bp 0x7f8cc7f346b0 sp 0x7f8cc7f346a0 READ of size 1 at 0x60c000079340 thread T1 #0 0x55d56b132d4a in nxt_openssl_conn_io_shutdown src/nxt_openssl.c:1466 #1 0x55d56b0f6a25 in nxt_h1p_closing src/nxt_h1proto.c:2069 #2 0x55d56b1009a6 in nxt_h1p_shutdown src/nxt_h1proto.c:2038 #3 0x55d56b1014c3 in nxt_h1p_request_close src/nxt_h1proto.c:1718 #4 0x55d56b1045c0 in nxt_http_request_close_handler src/nxt_http_request.c:864 #5 0x55d56b104988 in nxt_http_request_done src/nxt_http_request.c:795 #6 0x55d56b0ba0c3 in nxt_event_engine_start src/nxt_event_engine.c:542 #7 0x55d56b0dcac2 in nxt_router_thread_start src/nxt_router.c:3645 #8 0x55d56b0b421b in nxt_thread_trampoline src/nxt_thread.c:126 #9 0x7f8ccab95ac2 (/lib/x86_64-linux-gnu/libc.so.6+0x94ac2) #10 0x7f8ccac2784f (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)
2024-02-21Tests: check for the AddressSanitizer flag during discoveryAndrei Zeliankou2-0/+3
This flag is necessary to either run or skip certain tests that have specific behavior depending on whether AddressSanitizer is enabled. For instance, some tests may fail only when the binary is compiled with AddressSanitizer.
2024-02-21Tests: Ruby hook tests unstable for version older 3.0Andrei Zeliankou1-1/+4
It can fail with reporting following alert: [alert] 137462#137462 mount("none", "/tmp/unit-test-636e0uh8/proc", "proc", 2097162, "") (16: Device or resource busy)
2024-02-21Python: bytearray body support for ASGI module.Andrei Zeliankou2-0/+28
@filiphanes requested support for bytearray and memoryview in the request body here: <https://github.com/nginx/unit/issues/648> This patch implements bytearray body support only. Memoryview body still need to be implemented.
2024-02-20Tests: NJS request variablesAndrei Zeliankou1-1/+35
2024-02-14fix: Take options as well as requestListener (#1091)Gabor Javorszky2-0/+10
* Take options as well as requestListener Unit-http have not kept up with the signature of nodejs's http package development. Nodejs allows an optional `options` object to be passed to the `createServer` function, we didn't. This resulted in function signature errors when user code that did make use of the options arg tried to call unit's replaced function. This change changes the signature to be more in line with how nodejs does it discarding it and printing a message to stdout. * Add test file to start node application with options * Add changes to docs/changes.xml Closes: https://github.com/nginx/unit/issues/1043
2024-01-29Tests: "if" option in access logging.Andrei Zeliankou1-0/+62
Conditional access logging was introduced here: https://github.com/nginx/unit/commit/4c91bebb50d06b28e369d68b23022caa072cf62d
2024-01-26Node.js: fixed "httpVersion" variable formatAndrei Zeliankou1-1/+1
According to the Node.js documenation this variable should only include numbering scheme. Thanks to @dbit-xia. Closes: https://github.com/nginx/unit/issues/1085
2024-01-16Tests: added Ruby tests with array in header valuesAndrei Zeliankou4-0/+41
2024-01-15Tests: pathlib used where appropriateAndrei Zeliankou72-256/+306
Also fixed various pylint errors and style issues.
2023-11-29Update third-party components for the Java module.Sergey A. Osokin1-1/+1
2023-11-17Tests: added more expected Ruby features.Andrei Zeliankou3-0/+27
2023-11-17Tests: Ruby input.rewind is no longer required.Andrei Zeliankou2-17/+0
For more information see: https://github.com/rack/rack/commit/42aff22f708123839ba706cbe659d108b47c40c7
2023-11-17Node.js: ServerResponse.flushHeaders() implemented.Andrei Zeliankou2-0/+11
This closes #1006 issue on GitHub. Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
2023-11-08Tests: 8XXX used as default port range.Andrei Zeliankou101-412/+412
After the launch of the project, the testing infrastructure was shared with nginx project in some cases. To avoid port overlap, a decision was made to shift the port range for Unit tests. This problem was resolved a long time ago and is no longer relevant, so it is now safe to use port 8XXX range as the default, as it is more appropriate for testing purposes.
2023-11-08Var: $request_id variable.Andrei Zeliankou1-0/+20
This variable contains a string that is formed using random data and can be used as a unique request identifier. This closes #714 issue on GitHub.
2023-10-17Update third-party components for the Java module.Sergey A. Osokin1-1/+1
2023-10-11Tests: added PHP test with rewrite and query string.Andrei Zeliankou1-0/+30
This test reproduces https://github.com/nginx/unit/issues/964.
2023-10-10Update third-party components for the Java module.Sergey A. Osokin1-1/+1
2023-10-06Update third-party components for the Java module.Sergey A. Osokin1-1/+1
2023-10-02Tests: added Java test with multiple headers.Andrei Zeliankou1-0/+17
This test reproduce https://github.com/nginx/unit/issues/923.
2023-09-26Node.js: response body chunk can now be a Uint8Array.Andrei Zeliankou3-1/+9
Starting from Node.js 15.0.0 the chunk parameter of the response.write() can be a Uint8Array. This closes #870 issue on GitHub.
2023-09-04Tests: added tests for the "response_headers" option.Andrei Zeliankou1-0/+173
2023-07-11Tests: added tests for response header variables.Andrei Zeliankou2-0/+111
2023-07-10Tests: check TLS methods availability more carefully.Andrei Zeliankou2-0/+12
2023-07-10Tests: fixed exception handling.Andrei Zeliankou1-1/+3
2023-07-07Update third-party components for Unit's Java module.Sergey A. Osokin1-1/+1
2023-06-14Tests: no caching for $uri variable.Andrei Zeliankou1-0/+23