Commit Graph

462 Commits

Author SHA1 Message Date
Max Romanov cfba69781a Fixing multiple TLS-enabled listeners initialization.
Because of the incorrect 'last' field assignment, multiple listeners with
a TLS certificate did not initialize properly, which caused a router crash
while establishing a connection.

Test with multiple TLS listeners added.

The issue was introduced in the c548e46fe516 commit.

This closes #561 issue on GitHub.
2021-07-01 13:56:40 +03:00
Andrei Zeliankou b86891c4ef Tests: renamed share to static.
Also minor style changes.
2021-06-28 22:05:40 +01:00
Andrei Zeliankou 72420358be Tests: chroot test with permissions skipped under root. 2021-06-24 04:01:15 +01:00
Andrei Zeliankou f91fe4ce9e Tests: added tests for TLS "conf_commands" option. 2021-05-27 13:30:51 +01:00
Andrei Zeliankou 753ce145f7 Tests: added TLS test without close notify. 2021-05-26 21:47:12 +01:00
Oisin Canty d67a0c8711 Static: handled unknown MIME types when MIME-filtering active. 2021-05-26 16:48:11 +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 39c0fda24c Tests: added additional check in tests with timeouts. 2021-05-24 22:28:23 +01: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
Andrei Zeliankou d643900237 Tests: minor fixes. 2021-05-24 04:33:42 +01:00
Oisin Canty e50bb120e2 Tests: Python targets. 2021-05-20 13:03:12 +00:00
Andrei Zeliankou 2f0cca2e2b Tests: added test to check port release. 2021-05-18 16:35:54 +01:00
Andrei Zeliankou 1198118b3b Tests: fixed incorrect "--restart" mode performing. 2021-05-17 15:39:15 +01: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 07c6bf165d Tests: temporary dir removed after tests execution. 2021-05-11 15:30:12 +01:00
Andrei Zeliankou a17f7e03d4 Tests: added test for TLS with empty Subject field. 2021-05-07 17:42:48 +01:00
Andrei Zeliankou b9e8d8073c Tests: PHP test with getting variable before the script is loaded. 2021-05-07 16:55:42 +01:00
Oisin Canty 6703b68ed0 Tests: MIME filtering 2021-05-06 14:22:36 +00:00
Andrei Zeliankou e0a061955b Tests: added tests for openat2() features. 2021-05-05 12:36:57 +01:00
Andrei Zeliankou 5b332cae83 Tests: fixed "skip" descriptors check flag for controller. 2021-04-14 15:56:03 +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 46d8567dd7 Tests: unset LC_ALL variable in Ruby encoding test.
This change is necessary to set Encoding.default_external value correctly.
2021-04-01 00:05:44 +01:00
Andrei Zeliankou f43265ba2c Tests: removed skip_alert(). 2021-03-31 23:42:00 +01:00
Andrei Zeliankou 0ae75733f7 Tests: added file descriptor leak detection. 2021-03-31 03:24:01 +01:00
Andrei Zeliankou e8577afc21 Tests: SNI. 2021-03-26 21:06:23 +00:00
Andrei Zeliankou c093ee7ec5 Tests: added test for Ruby default encoding. 2021-03-26 15:42:58 +00:00
Max Romanov 178f232b3a Tests: fixed racing condition in websocket test 5_15.
Test case: "send a text message split into two fragments, then a continuation
frame with FIN = false where there is nothing to continue, then an unfragmented
text message, all sent in one chop".

The test case investigates immediate connection closing since there is no
message to continue.

The mirror server may send a response for the first frame before the test
сontinuation frame is received by the router.  In this case, the test will
receive a text frame before the close frame.
2021-03-24 11:43:41 +03:00
Sergey A. Osokin 175ef1c1db Java: upgrading third-party components. 2021-03-22 17:15:12 +03:00
Andrei Zeliankou d0591f07d7 Tests: fixed tests to work without openssl support. 2021-02-23 22:25:47 +00:00
Andrei Zeliankou af3b6ef37d Tests: added regex check. 2021-02-18 21:21:55 +00:00
Andrei Zeliankou cf530e19bc Tests: clear certificates after each test. 2021-02-15 03:11:26 +00:00
Andrei Zeliankou 11f7d833a9 Tests: increased timeout in wait_for_record(). 2021-02-10 16:34:37 +00:00
Andrei Zeliankou 4404097e05 Tests: added "--restart" option.
Now Unit do not restart after each test by default.
2021-02-08 23:32:27 +00:00
Andrei Zeliankou 42725137f7 Tests: added tests for "path" option in Python application. 2021-02-04 15:09:54 +00:00
Max Romanov e4e444b827 Router: fixing crash after WebSocket processing.
After WebSocket processing, the application port was released with incorrect
reason ("got request"), unnecessarily decrementing the active request counter.

The assertion was triggered only on application removal; a test was added
for this case.
2021-01-28 17:13:52 +03:00
Andrei Zeliankou d43a84139d Tests: added missing checks for configuration results. 2021-01-14 03:04:20 +00:00
Andrei Zeliankou 5d983ea762 Tests: added test for "procfs" option. 2021-01-13 06:24:41 +00:00
Andrei Zeliankou 22dac5bd62 Tests: "language_deps" option checked more carefully. 2021-01-13 06:24:32 +00:00
Andrei Zeliankou db9b70932b Tests: waitformount() and waitforunmount() introduced. 2021-01-13 06:24:26 +00:00
Andrei Zeliankou 6dc9c47ccd Tests: style. 2021-01-13 06:22:43 +00:00
Andrei Zeliankou f5ac143246 Tests: unit_stop() removed where possible.
Since wait_for_record() was introduced there is no need
to stop Unit before parsing unit.log.
2021-01-12 06:20:23 +00:00
Tiago Natel de Moura a0bc946db3 Tests: fixed test_respawn.py to act upon test processes.
Running `test_respawn_` test cases on a machine with Unit
daemon in background would fail tests because `ps ax` was
used without filtering out other unit instances.

This patch also prevents from tests killing other Unit
processes not related to tests.
2021-01-08 10:38:46 +00:00
Tiago Natel de Moura 13a06497de Tests: reordered asserts to avoid a test race.
The mount points are unmounted in the main process after it
detects the app process died.  By testing the `tmpfs: true`
first, it happens that main could start the `tmpfs: false`
test case before main cleans the old process mount points.
2021-01-07 16:51:27 +00:00
Max Romanov d3d6864bdc Node.js: ServerRequest and ServerResponse compliance to Stream API.
ServerRequest now inherit stream Readable object.  ServerResponse
provides 'writable' property.

Thanks to Wu Jian Ping (@wujjpp).

This closes #274, closes #317 issues and closes #502 PR on GitHub.
2020-12-29 19:00:54 +03:00
Andrei Belov 53af12def0 Tests: ability to run unitd with specified "--user" option. 2020-12-23 18:30:17 +03:00
Tiago Natel de Moura 03436d2ec2 Tests: introduced a separate cache directory for Go builds.
The Go compiler can't detect changes to C header files when
compiling CGO applications, and then this leads to Go test
samples being linked with wrong libunit.

This patch creates a new cache directory reused throughout
the test suite.
2020-12-21 11:00:46 +00:00
Tiago Natel de Moura 66ac35e9b9 Tests: fixed bug that disabled isolation tests. 2020-12-15 11:06:49 +00:00