Commit Graph

158 Commits

Author SHA1 Message Date
Andrei Zeliankou
5a8337933d Tests: pathlib used where appropriate
Also fixed various pylint errors and style issues.
2024-01-15 15:48:58 +00:00
Sergey A. Osokin
a922f9a6f0 Update third-party components for the Java module. 2023-11-29 10:28:44 -05:00
Andrei Zeliankou
0b85fe29f7 Tests: 8XXX used as default port range.
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-08 18:37:02 +00:00
Sergey A. Osokin
5265b7e058 Update third-party components for the Java module. 2023-10-17 13:43:51 -04:00
Sergey A. Osokin
d1a9069852 Update third-party components for the Java module. 2023-10-10 11:55:44 -04:00
Sergey A. Osokin
c905d0d393 Update third-party components for the Java module. 2023-10-06 12:22:03 -04:00
Sergey A. Osokin
de885feb06 Update third-party components for Unit's Java module. 2023-07-07 09:54:23 -04:00
Andrei Zeliankou
c183bd8749 Tests: get rid of classes in test files.
Class usage came from the unittest framework and it was always redundant
after migration to the pytest.  This commit removes classes from files
containing tests to make them more readable and understandable.
2023-06-14 18:20:09 +01:00
Andrei Zeliankou
ce2405ec3d Tests: prerequisites checking reworked.
Prerequisites check moved to the module level to simplify class structure.
Discovery and prerequisites checks functions moved to the separate files.
Introduced "require" fixture to provide per-test requirements check.
2023-06-12 14:16:59 +01:00
Andrei Zeliankou
31ff94add9 Tests: more fixtures.
Common methods from applications/proto.py converted to the fixtures.
sysctl check moved to the specific file where it is using.
Some options moved to the constructor to have early access.
2023-05-29 16:45:49 +01:00
Andrei Zeliankou
f55818059c Tests: Log reworked.
All log-related code moved to the log.py.
2023-05-29 14:23:52 +01:00
Andrei Zeliankou
3e4fa1e202 Tests: removed unused variables. 2023-05-25 14:26:12 +01:00
Konstantin Pavlov
e242b1454d Tests: relaxed jar glob.
We install jars with names like websocket-api-${NXT_JAVA_MODULE}-$NXT_VERSION.jar,
which translates to versioned NXT_JAVA_MODULE in the packaging system, e.g.
websocket-api-java11-1.30.0.jar.
2023-03-27 13:16:47 -07:00
Andrei Zeliankou
7934dcabbc Tests: switched to using f-strings.
Previously, it was necessary to support older versions of Python for
compatibility.  F-strings were released in Python 3.6.  Python 3.5 was
marked as unsupported by the end of 2020, so now it's possible to start
using f-strings safely for better readability and performance.
2023-02-21 17:21:29 +00:00
Andrei Zeliankou
7f046c80b9 Tests: removed list usage as default argument.
Mutable types as default arguments is bad practice since
they are evaluated only once when the function is defined.
2023-02-21 14:40:47 +00:00
OutOfFocus4
6dae517ebd Python: Added "prefix" to configuration.
This patch gives users the option to set a `"prefix"` attribute
for Python applications, either at the top level or for specific
`"target"`s. If the attribute is present, the value of `"prefix"`
must be a string beginning with `"/"`. If the value of the `"prefix"`
attribute is longer than 1 character and ends in `"/"`, the
trailing `"/"` is stripped.

The purpose of the `"prefix"` attribute is to set the `SCRIPT_NAME`
context value for WSGI applications and the `root_path` context
value for ASGI applications, allowing applications to properly route
requests regardless of the path that the server uses to expose the
application.

The context value is only set if the request's URL path begins with
the value of the `"prefix"` attribute. In all other cases, the
`SCRIPT_NAME` or `root_path` values are not set. In addition, for
WSGI applications, the value of `"prefix"` will be stripped from
the beginning of the request's URL path before it is sent to the
application.

Reviewed-by: Andrei Zeliankou <zelenkov@nginx.com>
Reviewed-by: Artem Konev <artem.konev@nginx.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
2022-12-14 11:30:30 +01:00
Sergey A. Osokin
c9c001ee16 Java: upgrading third-party components. 2022-12-14 01:43:24 +00:00
Andrei Zeliankou
12e2cbae8a Tests: stop execution if can't unmount any filesystem. 2022-12-12 16:27:02 +00:00
Andrei Zeliankou
648e91a623 Tests: pretty output.
Hide expected alerts by default.
Silence succesfull "go build" information.
2022-12-12 16:24:54 +00:00
Andrei Zeliankou
55b9a5307d Tests: fixed tests to run as privileged user. 2022-12-09 14:17:49 +00:00
Andrei Zeliankou
190691ade8 Tests: NJS. 2022-11-29 01:02:08 +00:00
Andrei Zeliankou
0d3b31e671 Tests: features and options checks improved.
Now version output evaluates only once.
OpenSSL checks more carefully.
2022-11-15 00:39:21 +00:00
Andrei Zeliankou
8e1e047191 Tests: don't try to return response when "no_recv" is True. 2022-10-11 13:49:10 +01:00
Andrei Zeliankou
6915ce1d1c Tests: added tests for basic statistics. 2022-09-05 23:06:16 +01:00
Andrei Zeliankou
d1cb8ab2bb Tests: added tests with abstract UNIX sockets. 2022-08-25 15:50:49 +01:00
Andrei Zeliankou
69e690affe Tests: added flags to search functions in proto.py.
Also removed unnesessary re.compile() calls.
2022-07-28 14:12:19 +01:00
Andrei Zeliankou
a3699557a3 Tests: minor improvements.
Added "go" availability check before trying to build an application.

update_action() method used were possible and fixed bug with
the relative path determination in test_static_chroot.py.

Templates optimization and style fixes.
2022-06-30 14:40:17 +01:00
Andrei Zeliankou
0f72534660 Tests: style. 2022-04-11 21:05:14 +01:00
Andrei Zeliankou
e53ce40c58 Tests: removed TestApplicationTLS.get_server_certificate().
distutils.version is replaced by packaging.version.  Also minor style fixes.
2022-01-31 23:10:30 +00:00
Max Romanov
1297e8a16a Tests: using modules in Go. 2022-01-10 16:07:31 +03:00
Andrei Zeliankou
ae03585238 Tests: refactored working with processes. 2021-11-15 12:13:54 +00:00
Max Romanov
b424a00ec5 Tests: PHP shared opcache test added. 2021-11-09 15:48:44 +03:00
Andrei Zeliankou
c27d0fe7bd Tests: removed unused imports. 2021-11-02 17:53:28 +00:00
Andrei Zeliankou
39adb292d5 Tests: style. 2021-10-18 01:10:11 +01:00
Max Romanov
b586707c86 Java: upgrading third-party components. 2021-08-12 14:55:51 +03:00
Max Romanov
1a85ad378f Java: upgrading third-party components. 2021-08-09 10:14:57 +03:00
Max Romanov
fa9fb29be2 Application restart introduced.
When processing a restart request, the router sends a QUIT message to all
existing processes of the application.  Then, a new shared application port is
created to ensure that new requests won't be handled by the old processes of
the application.
2021-07-29 19:50:39 +03:00
Andrei Zeliankou
960ffc9967 Tests: added SNI test without hostname in request. 2021-07-23 15:37:03 +01:00
Oisin Canty
8c83652c2a Tests: Ruby hooks. 2021-07-02 13:00:57 +00:00
Oisin Canty
6c14d5d7b1 Tests: run Ruby applications inside temporary directory. 2021-07-02 13:00:04 +00:00
Max Romanov
155e22da05 Go: fixing tests for Go 1.16.
In Go 1.16, the module-aware mode is enabled by default; to fall back to
previous behavior, the GO111MODULE environment variable should be set to
'auto'.

Details: https://golang.org/doc/go1.16
2021-05-25 18:00:59 +03:00
Andrei Zeliankou
1154ede862 Tests: test_settings_send_timeout improved.
Data length adjusts depending on socket buffer size when it's possible.
2021-05-24 05:26:15 +01:00
Oisin Canty
c160ea11e4 Node.js: renamed "require_shim" to "loader". 2021-05-24 09:01:42 +00:00
Oisin Canty
e50bb120e2 Tests: Python targets. 2021-05-20 13:03:12 +00:00
Andrei Zeliankou
25603eae9f Tests: added test for TLS with IP in SAN. 2021-05-12 14:37:25 +01:00
Oisin Canty
a0c083af20 Node.js: a shim for overriding "http" and "websocket" modules.
Also added stubs for Server.address()
This was done to prevent crashes in some popular frameworks like express

Supports both CommonJS and the new ES Modules system syntax e.g:

app.js:
const http = require('http')

app.mjs:
import http from "http"

Usage on Node 14.16.x and higher:
{
    "type": "external",
    "processes": {"spare": 0},
    "working_directory": '/project',
    "executable": "/usr/bin/env",
    "arguments": [
        "node",
        "--loader",
        "unit-http/require_shim.mjs"
        "--require",
        "unit-http/require_shim",
        "app.js"
    ]
}

Usage on Node 14.15.x and lower:
{
    "type": "external",
    "processes": {"spare": 0},
    "working_directory": '/project',
    "executable": "/usr/bin/env",
    "arguments": [
        "node",
        "--require",
        "unit-http/require_shim",
        "app.js"
    ]
}
2021-05-12 09:26:55 +00:00
Andrei Zeliankou
e0a061955b Tests: added tests for openat2() features. 2021-05-05 12:36:57 +01:00
Max Romanov
74b1b1fc17 Tests: preserving unit.log when run without restart.
Introducing "unit.log.Log" class for "unit.log" file management.
Moving "findall()" function into TestApplicationProto.
Using "os.kill()" to send signals.
2021-04-08 19:11:11 +03:00
Andrei Zeliankou
6c97a1a069 Tests: style. 2021-04-05 14:03:05 +01:00
Andrei Zeliankou
e8577afc21 Tests: SNI. 2021-03-26 21:06:23 +00:00