Commit graph

568 commits

Author SHA1 Message Date
Andrei Zeliankou
1fe1518ab1 Tests: fixed test_static_space_in_name. 2020-09-30 22:45:58 +01:00
Andrei Zeliankou
4de6ffa63f Tests: tuned delay in test_settings_idle_timeout_2. 2020-09-27 23:46:31 +01:00
Andrei Zeliankou
4095454946 Tests: added pytest.ini. 2020-09-27 23:27:19 +01:00
Max Romanov
efe65dee4d Tests: prerequisites check improved by using callable.
This is required for more flexible Python version check since ASGI works
for Python 3.5+.  Version check via 'startswith()' function removed as
not consistent.
2020-09-24 09:47:27 +03:00
Max Romanov
1fc51cf140 Tests: introduced module name configuration.
Also fixed problem with "/" in application name.
2020-09-22 19:53:19 +03:00
Max Romanov
dc49c561e2 Tests: improved response receiving while upgrade.
The patch required to process non-101 response.
2020-09-22 12:40:35 +03:00
Max Romanov
767c4cb508 Tests: using dict.get() method with default value.
No functional changes.  Only code readability improved.
2020-09-22 12:40:18 +03:00
Andrei Zeliankou
98c86c415c Tests: added variable test with nonexistent upstream. 2020-09-21 21:29:34 +01:00
Andrei Zeliankou
39008c1f05 Tests: added test for "idle_timeout" with empty payload. 2020-09-21 21:24:42 +01:00
Max Romanov
449652afa1 Tests: added multiple headers concatenation test. 2020-09-21 21:18:13 +03:00
Max Romanov
af964488ba Tests: changing Python application callable name. 2020-09-21 10:32:14 +03:00
hongzhidao
806135f1c9 Router: fixed "pass" to upstreams.
Messed up return values in nxt_upstream_find() caused error in applying any
configuration with a valid "pass" value in router configuration pointing to
upstream.  That wasn't the case in "listeners" objects, where the return value
wasn't checked.

Also, it caused segfault in cases where the "pass" option was configured with
variables and resulting value was pointing to a non-existent upstream.

Added missing return checks as well to catch possible memory allocation errors.

The bug was introduced in d32bc428f46b.

This closes #472 issue on GitHub.
2020-08-28 00:53:36 -04:00
Andrei Zeliankou
d5e9159340 Tests: migrated to the pytest. 2020-09-16 21:31:15 +01:00
Andrei Zeliankou
df374057f7 Tests: $host varaible test.
Also added few tests for $uri and minor style fixes.
2020-08-31 03:14:02 +01:00
Tiago Natel de Moura
d1bdaf98ba Tests: disable of language_deps. 2020-08-25 15:27:51 +01:00
Tiago Natel de Moura
244ffb2829 Tests: PHP extension mounts. 2020-08-25 13:48:33 +01:00
Tiago Natel de Moura
10738c3fe2 Tests: default tmpfs in rootfs. 2020-08-20 15:53:20 +01:00
Tiago Natel de Moura
479fdff39d Tests: set root by unprivilaged user. 2020-08-13 12:17:15 +01:00
Andrei Zeliankou
8032686a57 Tests: added test with error on loading application. 2020-08-13 13:17:27 +01:00
Andrei Zeliankou
c40e45344f Tests: added variables tests. 2020-08-13 13:17:01 +01:00
Max Romanov
496f41c134 Tests: reducing the number of generated applications.
Each application initializes a shared port with 2 file descriptors, so the test
fails because the router reaches the open files limit.
2020-08-11 19:20:25 +03:00
Max Romanov
bab4a9e9f2 Tests: skipping idle zero timeout.
This is a temporary solution after the 'shared port' patch.  The application
process becomes idle immediately after creation.  Even if it starts processing
a request (without acknowledging it yet), it is stopped by the router because
an 'out-of-idle-time' event occurs.
2020-08-11 19:20:23 +03:00
Andrei Zeliankou
f1e445bdef Tests: added PHP test with time check in error log messages. 2020-07-28 04:53:40 +01:00
Andrei Zeliankou
355ed9697d Tests: fixed double stop() call for some tests. 2020-07-28 04:53:32 +01:00
Andrei Zeliankou
dc1377dc48 Tests: style. 2020-07-28 03:09:50 +01:00
Max Romanov
661c223eda Tests: switching stdout to blocking before printing log.
This is another attempt to fix the following error message:
BlockingIOError: [Errno 11] write could not complete without blocking
2020-07-22 10:05:10 +03:00
Axel Duch
b6792b00ae Router: route patterns multi wildcards fix.
Matching 'start' and 'end' position now adjusted to avoid false matching.

This is related to #434 issue on Github.
Thanks to 洪志道 (Hong Zhi Dao).
2020-07-10 10:28:53 +01:00
Axel Duch
a9a21f6fe4 Router: route patterns multi wildcards support. 2020-07-04 03:24:07 +01:00
Andrei Zeliankou
9bd6baefae Tests: fixed opcache detection.
opcache_get_status() returns array, so square brackets
should be used to access "opcache_enabled" value.
2020-06-26 04:23:47 +01:00
Andrei Zeliankou
6e55f03dcd Tests: added chunked tests. 2020-06-24 04:11:09 +01:00
Tiago Natel de Moura
08b765ae42 Tests: Added rootfs tests. 2020-05-28 14:59:52 +01:00
Tiago Natel de Moura
e9e5ddd5a5 Refactor of process management.
The process abstraction has changed to:

  setup(task, process)
  start(task, process_data)
  prefork(task, process, mp)

The prefork() occurs in the main process right before fork.

The file src/nxt_main_process.c is completely free of process
specific logic.

The creation of a process now supports a PROCESS_CREATED state.  The
The setup() function of each process can set its state to either
created or ready.  If created, a MSG_PROCESS_CREATED is sent to main
process, where external setup can be done (required for rootfs under
container).

The core processes (discovery, controller and router) doesn't need
external setup, then they all proceeds to their start() function
straight away.

In the case of applications, the load of the module happens at the
process setup() time and The module's init() function has changed
to be the start() of the process.

The module API has changed to:

  setup(task, process, conf)
  start(task, data)

As a direct benefit of the PROCESS_CREATED message, the clone(2) of
processes using pid namespaces now doesn't need to create a pipe
to make the child block until parent setup uid/gid mappings nor it
needs to receive the child pid.
2020-03-09 16:28:25 +00:00
Andrei Zeliankou
fa4d4b6120 Tests: print unit.log in case of errors.
Thanks to hongzhidao.
2020-05-20 23:06:56 +01:00
Andrei Zeliankou
82471c1dd3 Tests: added tests for "targets" option. 2020-05-15 04:21:25 +01:00
Andrei Zeliankou
ea841400f5 Tests: added test for encoding in the "pass" option. 2020-05-15 04:21:10 +01:00
Andrei Zeliankou
ce4a2bbd05 Tests: style. 2020-05-15 04:20:56 +01:00
Andrei Zeliankou
cf73fb8093 Tests: test_proxy_invalid simplified. 2020-05-15 04:20:45 +01:00
Axel Duch
26f407e24a Tests: decode uri and args. 2020-05-14 12:29:22 +02:00
Valentin Bartenev
0174c971b5 Configuration: URI encoding in the "pass" option.
This is useful to escape "/" in path fragments.  For example, in order
to reference the application named "foo/bar":

  {
      "pass": "applications/foo%2Fbar"
  }
2020-05-14 13:15:00 +03:00
Andrei Zeliankou
d803ec39bc Tests: added respawn tests. 2020-05-12 17:59:47 +01:00
Andrei Zeliankou
6a9a4fe0d4 Tests: introduced module version specification in prerequisites. 2020-04-24 05:08:56 +01:00
Andrei Zeliankou
8f6e6086cb Tests: skips adjusted. 2020-04-20 14:04:55 +01:00
Andrei Zeliankou
3c58a4bfc1 Tests: added test with rescheduling requests. 2020-04-14 03:02:16 +01:00
Andrei Zeliankou
0bfa09dfa0 Tests: minor fixes and style. 2020-04-14 02:35:04 +01:00
Valentin Bartenev
c7f5c1c664 Controller: improved handling of unix domain control socket.
One of the ways to detect Unit's startup and subsequent readiness to accept
commands relies on waiting for the control socket file to be created.
Earlier, it was unreliable due to a race condition between the client's
connect() and the daemon's listen() calls after the socket's bind() call.

Now, unix domain listening sockets are created with a nxt_listen_socket_create()
call as follows:

   s = socket();
   unlink("path/to/socket.tmp")
   bind(s, "path/to/socket.tmp");
   listen(s);
   rename("path/to/socket.tmp", "path/to/socket");

This eliminates a time-lapse when the socket file is already created but nobody
is listening on it yet, which therefore prevents the condition described above.

Also, it allows reliably detecting whether the socket is being used or simply
wasn't cleaned after the daemon stopped abruptly.  A successful connection to
the socket file means the daemon has been started; otherwise, the file can be
overwritten.
2020-04-08 15:15:24 +03:00
Andrei Zeliankou
a49023229e Tests: use "return" action in upstream tests. 2020-04-03 01:49:18 +01:00
Andrei Zeliankou
d7aa514d6a Tests: added notification on "read_timeout" expiration. 2020-04-03 01:46:59 +01:00
Andrei Zeliankou
2bb8b3d88a Tests: minor fixes. 2020-04-03 01:03:26 +01:00
Andrei Zeliankou
5954839773 Tests: added tests for rational numbers in upstream server weight. 2020-03-30 18:44:50 +01:00
Max Romanov
0935630cba Fixing application process infinite loop.
Main process exiting before app process init may have caused hanging.
2020-03-30 14:18:51 +03:00
Max Romanov
ab7b42a072 Handling change file message in libunit.
This is required for proper log file rotation action.
2020-03-30 14:18:41 +03:00
Andrei Zeliankou
f94e31b294 Tests: added tests for "location" option. 2020-03-27 17:29:45 +00:00
Andrei Zeliankou
6e5b5d2a0b Tests: added tests for "return" action. 2020-03-27 15:50:09 +00:00
Andrei Zeliankou
5f2d07019c Tests: increase default "read_timeout" to 60s in message_read(). 2020-03-27 15:48:39 +00:00
Andrei Zeliankou
8532cf6ae6 Tests: added tests for comments in JSON. 2020-03-25 19:40:08 +00:00
Andrei Zeliankou
2e4ad9fbc0 Tests: UTF-8 BOM test. 2020-03-25 19:31:42 +00:00
Andrei Zeliankou
48ad88ee72 Tests: increase default "read_timeout" value to 60s.
This change is necessary to avoid errors on slow hosts.

Also slightly reworked argument passing to the recvall() function.
2020-03-23 19:18:26 +00:00
Andrei Zeliankou
ac9ca6d75c Tests: added notification on unsuccessful connect(). 2020-03-23 19:12:22 +00:00
Andrei Zeliankou
b0161df42e Tests: wait for unit.pid file before running tests.
Waiting for control.unit.sock was replaced by unit.pid due to current problem
with race between connect() and listen() calls for control.unit.sock.

This change should be reverted after fix.
2020-03-23 19:09:29 +00:00
Andrei Zeliankou
3fd4b4cfab Tests: rearranging functions in main.py. 2020-03-23 02:13:46 +00:00
Andrei Zeliankou
c7cc247baa Tests: terminate unitd process on exit(). 2020-03-23 02:12:44 +00:00
Andrei Zeliankou
93207d4a8c Tests: test_python_procman.py refactored. 2020-03-19 03:17:00 +00:00
Andrei Zeliankou
06c790ac1e Tests: fixed prerequisite in test_share_fallback.py. 2020-03-19 03:15:50 +00:00
Max Romanov
c6f9ca79e6 Fixing body fd access racing condition.
To avoid closing the body fd prematurely, the fd value is moved from
the request struct to the app link.  The body fd should not be closed
immediately after the request is sent to the application due to possible
request rescheduling.
2020-03-17 14:44:11 +03:00
Andrei Zeliankou
baf9230398 Tests: skip "close failed" alert in test_proxy_parallel test. 2020-03-12 17:14:16 +00:00
Max Romanov
5296be0b82 Using disk file to store large request body.
This closes #386 on GitHub.
2020-03-12 17:54:29 +03:00
Max Romanov
f3e6726098 Tests: added Python input readline and iterator tests. 2020-03-12 17:54:15 +03:00
Andrei Zeliankou
23636ce02c Tests: fixed race in USR1 signal tests.
Also, minor style fixes applied.
2020-03-12 13:48:54 +00:00
Andrei Zeliankou
1d75277767 Tests: round robin upstream tests. 2020-03-12 13:47:43 +00:00
Andrei Zeliankou
961674af42 Tests: skip "last message send failed" alerts globally. 2020-03-12 13:44:30 +00:00
Andrei Zeliankou
b214b7c690 Tests: more routing tests with negative rules. 2020-01-31 18:12:16 +00:00
Andrei Zeliankou
f092b093f5 Tests: use blocking to print unit.log files. 2020-03-10 18:13:47 +00:00
Andrei Zeliankou
f36f0f2461 Tests: redirect tests output to the stdout. 2020-03-10 18:10:42 +00:00
Valentin Bartenev
810b8dbb67 Tests: unitd stderr output redirected to unit.log.
A part of the debug log was printed to stderr before the log file was opened.
Now, this output is redirected to the same log file.
2020-03-06 20:08:38 +03:00
Valentin Bartenev
3617d4ed03 Tests: simplified unitd process running.
There are no reasons to wrap the Unit daemon in a separate Python process.
2020-03-06 20:08:29 +03:00
Tiago Natel de Moura
80763b3e64 Tests: chdir() and open() for PHP module.
These tests ensure optimizations in the chdir calls don't break
SAPI semantics.
2020-03-03 18:53:26 +00:00
Andrei Zeliankou
293b0da520 Tests: added tests for "fallback" option for the "share" action. 2020-03-03 18:17:31 +00:00
Andrei Zeliankou
3b7b2fae54 Tests: check unique options in "action" object. 2020-03-03 17:54:02 +00:00
Valentin Bartenev
a60f856ce2 Improved validation of the "action" object.
Now it enforces the mutual exclusivity of "pass", "proxy", and "share" options.
2020-03-03 20:37:47 +03:00
Andrei Zeliankou
f68947bc60 Tests: truncated huge messages while logging. 2020-03-02 13:10:38 +00:00
Andrei Zeliankou
5d67879a50 Tests: added "-r" option to print unit.log on failures. 2020-02-27 18:41:24 +00:00
Andrei Zeliankou
fbc72d7fec Tests: added test with invalid IPv6 address in routing block. 2020-02-27 01:37:54 +00:00
Andrei Zeliankou
f519e31e2d Tests: more static tests. 2020-02-21 15:08:38 +00:00
Andrei Zeliankou
5406d1e320 Tests: added PHP test with invalid index extension only. 2020-02-20 21:06:56 +00:00
Andrei Zeliankou
1f2445b01b Tests: added proxy test with large body. 2020-02-20 21:06:31 +00:00
Andrei Zeliankou
fcca366392 Tests: more tests with "max_body_size". 2020-02-20 20:33:49 +00:00
Tiago Natel de Moura
12e15ba43b Tests: added test for uploading files with SSL.
* * *
[mq]: multipart
2020-02-05 13:29:41 +00:00
Tiago Natel de Moura
d3e218a8c3 Tests: add helper for form-data and multipart. 2020-02-05 13:13:04 +00:00
Max Romanov
81b39d0b35 Tests: fixing Python 3.8.1 errors on Mac.
- "Can't pickle local object ..."
- "if __name__ == '__main__':" pattern required for multiprocessing
2020-02-04 11:39:34 +03:00
Tiago Natel de Moura
117a4f11b9 Tests: check for php extension. 2020-01-23 11:57:15 +00:00
Max Romanov
693a458b4e Go: changing import name for "unit.nginx.org/go".
This patch includes packaging changes - update unit-go installation
directory.
2019-12-25 20:00:32 +03:00
Axel Duch
96a9a790a0 Tests: routing by listener address. 2019-12-24 13:59:58 +00:00
Axel Duch
ee8fa5d467 Tests: routing by client address configuration. 2019-12-24 13:58:22 +00:00
Max Romanov
a427ecd4c5 Go: installing go module for tests into build directory. 2019-12-24 17:59:48 +03:00
Andrei Zeliankou
c2a7e403ef Tests: routing tests refactored. 2019-12-09 15:34:35 +03:00
Tiago Natel
752ffd1950 Tests: added privileged credential tests. 2019-12-06 17:02:23 +00:00
Tiago Natel
c6a11260e8 Tests: added tests for setting user and group. 2019-11-11 14:36:22 +00:00
Tiago Natel
abbad122bb Tests: added support for testing "user" and "group". 2019-11-11 14:35:29 +00:00
Tiago Natel
224787bbac Tests: added getjson() helper. 2019-11-26 16:00:11 +00:00
Tiago Natel
01103c5005 Tests: parsing of "Transfer-Encoding: chunked" responses. 2019-11-26 15:58:25 +00:00
Tiago Natel
19b974674c Tests: fixed tests to run as root.
- The mode of testdir was changed to allow reading from other users/groups.
- The java multipart test now uploads the file into an app writable dir.
- The build directory was made readable for other users.
- The python environment test now uses the HOME env var instead of PWD
  because the latter is not set by the root shell (/bin/sh) by default.
- The node `node_modules` directory now is copied into the `testdir` instead
  of using symlinks.
2019-11-09 20:14:52 +00:00
Andrei Zeliankou
1072c94829 Tests: Python exception tests. 2019-11-14 18:46:28 +03:00
Andrei Zeliankou
c7726c0eb1 Tests: proxy tests. 2019-11-14 17:15:29 +03:00
Andrei Zeliankou
efb461c0e1 Tests: run_process() and stop_processes() introduced. 2019-11-14 17:15:20 +03:00
Andrei Zeliankou
b5e3e22a46 Tests: waitforsocket() introduced. 2019-11-14 17:14:55 +03:00
Andrei Zeliankou
5452ee458d Tests: fixed websocket tests. 2019-11-13 18:11:24 +03:00
Andrei Zeliankou
45d75ee2cb Tests: added Python test with threading. 2019-11-13 16:51:12 +03:00
Andrey Zelenkov
defb14f165 Tests: added Ruby test with constants. 2019-11-13 15:53:56 +03:00
Andrey Zelenkov
ed3298a3c6 Tests: fixed operator in http.py. 2019-11-08 14:04:32 +03:00
Andrey Zelenkov
13b4538fc7 Tests: added test with invalid "working_directory" value. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
d58fe3db98 Tests: more URI normalization tests. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
38cfe4cf3d Tests: added USR1 signal test for unit.log. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
1033cfa3b0 Tests: more static tests. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
47436e9be5 Tests: improved handshake for websocket tests. 2019-10-23 16:26:06 +03:00
Andrey Zelenkov
f878b6eea5 Tests: style. 2019-10-23 16:05:52 +03:00
Andrey Zelenkov
f5b1ac0dc6 Tests: check initial configuration in test_access_log.py. 2019-10-23 16:05:44 +03:00
Andrey Zelenkov
31bbc755fd Tests: check initial configuration in test_routing.py. 2019-10-23 16:05:40 +03:00
Andrey Zelenkov
1bece759a3 Tests: added flush() in "errors_write" Python application. 2019-10-23 16:05:35 +03:00
Tiago Natel
0beb8ea5e1 Fixed passing false in namespace flags.
This patch closes #328 in github.
2019-10-11 10:00:06 +00:00
Andrey Zelenkov
486b202cc1 Tests: default port number used. 2019-10-08 00:28:40 +03:00
Andrey Zelenkov
faf4ad5478 Tests: increased subprocess timeout on Unit exit.
Also changed order of subprocess status checks.
_terminate_process() method removed.
2019-10-08 00:28:40 +03:00
Andrey Zelenkov
d82f125368 Tests: fixed hanging of Go tests.
This closes #319 issue on GitHub.
2019-09-25 19:21:42 +03:00
Andrey Zelenkov
702ca2b853 Tests: static tests with file system objects. 2019-09-24 16:13:20 +03:00
Andrey Zelenkov
2503226729 Tests: serving static files. 2019-09-19 17:11:37 +03:00
Tiago de Bem Natel de Moura
c554941b4f Initial applications isolation support using Linux namespaces. 2019-09-19 15:25:23 +03:00
Andrey Zelenkov
26fcb46137 Tests: added read_buffer_size option in http(). 2019-09-18 00:25:57 +03:00
Andrey Zelenkov
23215c839f Tests: head() method introduced. 2019-09-17 21:15:15 +03:00
Valentin Bartenev
6352c21a58 HTTP parser: fixed parsing of target after literal space character.
In theory, all space characters in request target must be encoded; however,
some clients may violate the specification.  For the sake of interoperability,
Unit supports unencoded space characters.

Previously, if there was a space character before the extension or arguments
parts, those parts weren't recognized.  Also, quoted symbols and complex
target weren't detected after a space character.
2019-09-17 18:40:21 +03:00
Andrey Zelenkov
b5394c3956 Tests: fixed features check. 2019-09-16 17:49:49 +03:00
Andrey Zelenkov
65ca2d7b19 Tests: refactored prerequisites model. 2019-09-14 14:44:35 +03:00
Andrey Zelenkov
962cdb6659 Tests: prepare_env() introduced. 2019-09-16 15:37:32 +03:00
Andrey Zelenkov
13ecbe333a Tests: style and minor fixes in java.py. 2019-09-16 15:37:32 +03:00
Andrey Zelenkov
a5b9c9241e Tests: more comments. 2019-09-16 15:37:32 +03:00
Andrey Zelenkov
7152162886 Tests: set default "unsafe" value. 2019-09-16 15:37:32 +03:00
Andrey Zelenkov
f10a8a03a1 Tests: Java websockets tests. 2019-09-05 15:30:09 +03:00
Max Romanov
2b8cab1e24 Java: introducing websocket support. 2019-09-05 15:27:32 +03:00
Andrey Zelenkov
3e23afb0d2 Tests: increased read_timeout for websockets tests. 2019-09-03 21:23:32 +03:00
Andrey Zelenkov
1cfd329b3d Tests: fixed recv_bytes() in websockets.py. 2019-09-02 18:03:33 +03:00
Andrey Zelenkov
790b4f8f00 Tests: removed duplicate websocket tests. 2019-09-02 18:03:17 +03:00
Andrey Zelenkov
70e808040d Tests: prevented writing non-chopped frames to the closed socket. 2019-09-02 14:55:00 +03:00
Andrey Zelenkov
cb36616132 Tests: prevented writing to the closed socket for websocket tests. 2019-08-30 16:59:35 +03:00
Andrey Zelenkov
ccd6c0dc05 Tests: websockets style fixes. 2019-08-30 15:37:44 +03:00
Andrey Zelenkov
c47af243b0 Tests: removed keepalive_interval for websocket tests.
Also increased read_timeout in frame_read() for slow hosts.
2019-08-22 21:28:03 +03:00
Andrey Zelenkov
72b56388b7 Tests: Node.js websockets tests tuned. 2019-08-22 18:28:23 +03:00
Andrey Zelenkov
9bbf54e23e Tests: Node.js websockets. 2019-08-22 15:33:41 +03:00
Andrey Zelenkov
08601bbbf0 Tests: "--unsafe" option introduced. 2019-08-22 15:26:15 +03:00
Andrey Zelenkov
b4c09e2954 Tests: reverted rerun for Java tests in 5e429a7f133c.
Each testcase should also recompile to be recompiled.
So backed out for now.
2019-08-21 14:24:23 +03:00
Andrey Zelenkov
4d7576d323 Tests: print decoded strings in detailed mode, if possible. 2019-08-14 16:26:47 +03:00
Andrey Zelenkov
ac316ff7a5 Tests: fixed port reusing to avoid access issues. 2019-08-14 15:53:58 +03:00
Max Romanov
4bef4256c0 Java: implementing multipart message support.
This closes #265 issue on GitHub.
2019-08-14 15:24:41 +03:00
Andrey Zelenkov
8904c87c6b Tests: goftm used for Go applications. 2019-08-14 14:06:28 +03:00
Andrey Zelenkov
b3b7013eda Tests: added tests for deleting listeners and applications objects. 2019-08-14 14:06:22 +03:00
Andrey Zelenkov
78fbf9ee60 Tests: fixed modules version parsing. 2019-08-08 15:47:26 +03:00
Andrey Zelenkov
e8d1c760d6 Tests: Java multipart test. 2019-08-07 14:43:38 +03:00
Andrey Zelenkov
c8c259b972 Tests: rerun tests for each module version.
Rerun supported for Python, PHP, Perl, Ruby, and Java modules.
2019-08-06 18:25:13 +03:00
Valentin Bartenev
7fd9444728 Node.js: returning "this" from writeHead() to allow chaining.
In Node.js version 11.10.0 and later, the writeHead() function returns "this".
2019-08-06 16:24:11 +03:00
Andrey Zelenkov
fdf570f1d9 Tests: added delay before SIGQUIT in access_log partial tests.
This change is necessary to avoid race between
client connection close and Unit close.

Also "read_timeout" value decreased to speed up tests.
2019-08-01 18:15:00 +03:00
Axel Duch
7785c96c1a Added routing based on request scheme.
Scheme matches exact string “http” or “https”.
2019-07-24 13:47:35 +03:00
Andrey Zelenkov
b1165d2edc Tests: fixed test_java_conf_error to pass with "--modules=" option. 2019-07-23 14:58:27 +03:00
Andrey Zelenkov
a920215a5c Tests: more Java tests.
Added test with war file and error configuration test.
2019-07-17 17:48:35 +03:00
Andrey Zelenkov
4153fad89d Tests: added PHP tests with "script" and "index" options. 2019-07-17 16:50:24 +03:00
Andrey Zelenkov
ce1fbd9273 Tests: simplified one route case configuration.
No functional changes.
2019-07-14 23:49:45 +03:00
Andrey Zelenkov
b097476824 Tests: TestApplicationTLS.openssl_conf() introduced. 2019-07-14 23:49:37 +03:00
Andrey Zelenkov
72e987e110 Tests: check application configuration loading in TLS tests. 2019-07-14 23:49:31 +03:00
Andrey Zelenkov
ff5413f109 Tests: removed unnecessary initialization.
That could leads to the incorrect behaviour in test_tls_application_respawn.
2019-07-14 23:47:49 +03:00
Andrey Zelenkov
ee1f0365d2 Tests: removed unused import. 2019-07-14 23:47:07 +03:00
Andrey Zelenkov
d7516e5f4e Tests: made openssl certificates more strong to avoid errors. 2019-07-08 20:46:06 +03:00
Andrey Zelenkov
4ea7d71405 Tests: added PATH_INFO variable test. 2019-07-08 19:23:33 +03:00
Valentin Bartenev
924165c90b PHP: improved response status code handling.
There's no reason to parse "http_status_line"; the PHP interpreter already
does this.  If the line contains a valid status code, it's assigned to
"http_response_code".

This also fixes invalid status line handling, where the nxt_int_parse()
function returned -1; it was cast to unsigned, yielding response code 65535.
2019-07-05 18:42:30 +03:00
Andrey Zelenkov
bcb9048c46 Tests: adjusted inactive interval in Java app for slow hosts. 2019-07-02 16:44:08 +03:00
Andrey Zelenkov
29225c4fc6 Tests: removed misleading comments in test_routing.t. 2019-07-02 15:36:13 +03:00
Igor Sysoev
1f8c395fc0 Cookie-based routing should be case-sensitive. 2019-06-10 18:47:35 +03:00
Andrey Zelenkov
7927c20b3b Tests: routing "cookies" tests. 2019-05-30 16:47:39 +03:00
Andrey Zelenkov
c0ed2c02ab Tests: routing "arguments" tests. 2019-05-30 16:47:39 +03:00
Andrey Zelenkov
89bf008880 Tests: routing "headers" tests. 2019-05-30 16:47:39 +03:00
Andrey Zelenkov
67772cd3e9 Tests: fixed tests without "Host" header. 2019-05-30 16:47:39 +03:00
Andrey Zelenkov
90c5d3f5c0 Tests: adjusted skipping tests. 2019-05-30 16:46:04 +03:00
Andrey Zelenkov
7ad4a76704 Tests: configure arrays with PUT tests. 2019-05-30 16:44:14 +03:00
Andrey Zelenkov
c4ed3025b3 Tests: more routing tests with arrays. 2019-04-26 17:35:32 +03:00
Andrey Zelenkov
2ceee3471e Tests: TestControl.conf_post() introduced. 2019-04-26 17:35:32 +03:00
Andrey Zelenkov
bc4a1d86b9 Tests: TestControl refactored. 2019-04-26 17:35:31 +03:00
Andrey Zelenkov
644e6df687 Tests: check application configuration loading. 2019-04-26 17:35:26 +03:00
Andrey Zelenkov
7a559c6568 Tests: using blocking for large output. 2019-04-22 18:52:46 +03:00
Andrey Zelenkov
5d15d8449d Tests: read_timeout increased for incomplete requests.
Also fixed test without \"Host\" header.
2019-04-22 18:52:35 +03:00
Andrey Zelenkov
1c56579ebd Tests: fixed naming. 2019-04-22 18:37:46 +03:00
Valentin Bartenev
c1a3b06d03 Tests: using "pass" option instead of deprecated "application". 2019-04-22 18:20:53 +03:00
Andrey Zelenkov
0c12afbf6a Tests: using low-case header names in Node.js tests. 2019-04-18 19:27:12 +03:00
Andrey Zelenkov
704529e4b1 Tests: more wildcard pattern tests for routing. 2019-04-15 16:08:53 +03:00
Andrey Zelenkov
b3179538ef Tests: wait more time on Unit closing. 2019-04-15 15:52:32 +03:00
Andrey Zelenkov
0f8a602c3c Tests: added time to handle requests in access_log partial tests. 2019-04-15 15:52:32 +03:00
Andrey Zelenkov
ac7e65a722 Tests: check unitd availability before start. 2019-04-09 20:59:41 +03:00
Andrey Zelenkov
dfb625789b Tests: read_timeout increased. 2019-04-09 20:59:41 +03:00
Andrey Zelenkov
29b4e4431f Tests: speed up tests. 2019-04-09 20:59:35 +03:00
Andrey Zelenkov
549f0873c2 Tests: wait_for_record() introduced. 2019-04-09 16:14:42 +03:00
Andrey Zelenkov
cfcf4da7fa Tests: added "name" argument for search_in_log(). 2019-04-09 16:14:42 +03:00
Andrey Zelenkov
8c7411415a Tests: style. 2019-04-09 16:14:42 +03:00
Andrey Zelenkov
af24e4dec4 Tests: simplified module checking. 2019-04-09 16:14:42 +03:00
Andrey Zelenkov
19eba1730a Tests: unit module refactoring. 2019-03-28 18:43:13 +03:00
Andrey Zelenkov
06b9a11494 Tests: speed up Java tests. 2019-03-26 23:39:15 +03:00
Andrey Zelenkov
281899fcef Tests: style. 2019-03-26 23:38:30 +03:00
Max Romanov
b96e5fd848 Turning off port read event state after main process fork.
Master port stores two file descriptors and works as a read port on the master
process side.  After a fork, the port switches into write mode and the read
socket closes, but the same event structure is used for the write socket.
However, the inherited structure remained in read state, telling the epoll
engine to use MOD operation instead of ADD.  The patch resets read event
state, so the engine may write using proper ADD operation.
2019-03-25 14:49:28 +03:00
Max Romanov
452ce0789e Adjusting request schema value according to connection tls state.
This closes #223 issue on GitHub.
2019-03-21 13:55:57 +03:00
Max Romanov
e1c4568680 Introducing one more large config test, but without sockets. 2019-03-05 15:38:52 +03:00
Andrey Zelenkov
ea844a4444 Tests: skip more alerts. 2019-03-01 18:58:16 +03:00
Andrey Zelenkov
ae36276cfc Tests: made tests compatible with PHP 5.3. 2019-03-01 18:58:16 +03:00
Andrey Zelenkov
754b85c3ee Tests: Perl streaming body and delayed response simple tests. 2019-03-01 17:13:51 +03:00
Alexander Borisov
3b2c1d0eaa Perl: added implementation delayed response and streaming body. 2019-03-01 16:50:25 +03:00
Andrey Zelenkov
c1751f9de6 Tests: specify ssl_version option.
TLS is explicitly selected to prevent using of SSL protocol
in ssl.get_server_certificate() call for Python 3.4 and older.
2019-02-28 21:19:32 +03:00
Andrey Zelenkov
38ea191fbb Tests: fixed PHP "disable_functions" and "disable_classes" tests. 2019-02-28 21:18:33 +03:00
Valentin Bartenev
a5dd0f8aa9 Made QUERY_STRING mandatory.
According to CGI/1.1 RFC 3875:

   The server MUST set this variable; if the Script-URI does not include a
   query component, the QUERY_STRING MUST be defined as an empty string ("").

Python's PEP 333(3) allows omitting it in WSGI interface; PHP docs force no
requirements; PSGI and Rack specifications require it even if empty.

When nginx proxies requests over FastCGI, it always provides QUERY_STRING.
and some PHP apps have been observed to fail if it is missing (see issue
#201 on GitHub).

A drawback of this change (besides a small overhead) is that there will be
no easy way to tell a missing query string from an empty one (i.e. requests
with or without the "?" character); yet, it's negligible compared to the
possible benefits of wider application compatibility.

This closes #226 issue on GitHub.
2019-02-28 20:20:41 +03:00
Max Romanov
5bfdebb9e4 Introducing Java Servlet Container beta. 2019-02-28 18:02:42 +03:00
Andrey Zelenkov
4b92586530 Tests: "Host" header tests. 2019-02-27 20:41:30 +03:00
Andrey Zelenkov
8488666d60 Tests: routing. 2019-02-27 19:46:27 +03:00
Andrey Zelenkov
bd77c9a4d2 Tests: read_timeout option introduced.
Also, increased default select() timeout from 1s to 5s.
2019-02-27 19:43:14 +03:00
Andrey Zelenkov
4de2c8b567 Tests: added "Host" and "Connetion" headers where necessary.
Also minor header organizing.
2019-02-27 19:15:02 +03:00
Alexander Borisov
379e4c75fd Perl: added processing for IO:Handle-like object.
The application can return the body as an IO:Handle-like object
without file descriptor.
2019-02-27 17:27:41 +03:00
Andrey Zelenkov
499096a55a Tests: one more alert skipped in test_json_application_many. 2019-02-20 20:46:23 +03:00
Andrey Zelenkov
955050aea3 Tests: skip sendmsg()/recvmsg() alerts for all tests.
Currently, these alerts may appear in the log when any application exits.
2019-02-20 20:28:29 +03:00
Andrey Zelenkov
09fb847cc7 Tests: removed test_http_header_transfer_encoding_chunked. 2019-02-20 20:24:05 +03:00
Andrey Zelenkov
b2ca342902 Tests: JSON array allowed. 2019-02-20 20:20:02 +03:00
Andrey Zelenkov
ac10bf8c7b Tests: fixed ports range. 2019-02-20 20:19:55 +03:00
Valentin Bartenev
2a6b54c230 Rejecting requests with duplicate "Content-Length". 2019-02-18 16:51:30 +03:00
Andrey Zelenkov
ab40732c08 Tests: added tests for "Content-Length" header. 2019-02-14 16:09:58 +03:00
Andrey Zelenkov
0e5aaf60d4 Tests: headers with equal header fields allowed. 2019-02-14 16:09:54 +03:00
Andrey Zelenkov
7ce9f61cb6 Tests: minor fixes. 2019-02-14 16:09:19 +03:00
Andrey Zelenkov
d60fbc6d44 Tests: large configuration tests. 2019-01-28 17:17:23 +03:00
Andrey Zelenkov
7dddfe2143 Tests: added test for reading body from IO::Handle-like object. 2019-01-28 17:16:50 +03:00
Andrey Zelenkov
eced6bc972 Tests: removed blocking mode customization for sockets.
This customization was added in 0e12b17e512d and left unused.
Also, set blocking mode by default for all sockets.
2019-01-28 15:11:50 +03:00
Andrey Zelenkov
17068d2cdc Tests: removed skipping Go tests on x86. 2018-12-25 21:28:02 +03:00
Andrey Zelenkov
5964413066 Tests: added delay to wait for error logging. 2018-12-25 17:22:32 +03:00
Andrey Zelenkov
4ccf0c8a17 Tests: fixed test_tls_reconfigure.
Previously, order of applying TLS configuration and sending partial request to
the application was uncertain.  These changes make sure that client-application
connection was established before reconfiguration.  Additionally, added test
to check that non-TLS connection works correctly after reconfiguration.
2018-12-25 16:35:35 +03:00
Andrey Zelenkov
f5b7fee128 Tests: set TCP_NODELAY option by default. 2018-12-25 16:35:35 +03:00
Andrey Zelenkov
d625691ff4 Tests: test_node_application_write_before_writeHead reworked.
Added res.end() call in application and response status check.
Also, renamed to test_node_application_write_before_write_head.
2018-12-25 16:35:35 +03:00
Andrey Zelenkov
f57e729a11 Tests: expectedFailure's removed from test_node_application.py.
Also removed alert skip in test_node_application_write_before_writeHead.

Fixes committed in 1340e3539362, 1e008ef94f43, 5df32621af19, dae402cb243f
and 41f561b3a178.
2018-12-25 16:35:35 +03:00
Andrey Zelenkov
f9a3328a25 Tests: more QUERY_STRING tests. 2018-12-24 20:35:18 +03:00
Andrey Zelenkov
aafa4bbaf9 Tests: more Node.js tests. 2018-12-11 18:30:58 +03:00
Andrey Zelenkov
37cd6d23b6 Tests: PHP directives "disable_classes" and "disable_functions". 2018-11-28 03:14:38 +03:00
Andrey Zelenkov
2ef5011236 Tests: fixed test_node_application_write_callback.
Fixed the write() callback order test.
Also introduced a separate test to verify the callback call itself.
2018-12-04 19:05:10 +03:00
Sergey Kandaurov
0fdc7c3a55 Tests: Node.js application tests. 2018-10-25 15:43:48 +03:00
Andrey Zelenkov
41d3d63758 Tests: class prefix made optional. 2018-11-15 21:26:15 +03:00
Andrey Zelenkov
eff760bd2b Tests: added command line arguments parsing in tests.
Added the following command line arguments:

  -d, --detailed: Show detailed output for tests

    Usage examples:

    ./test/run.py --detailed
    python3 test/test_access_log.py --detailed
    python3 test/test_access_log.py -d TestUnitAccessLog.test_access_log_ipv6


  -l, --log: Save unit.log after the test execution

    Usage examples:

    ./test/run.py -l
    python3 test/test_access_log.py -l
    python3 test/test_access_log.py --log TestUnitAccessLog.test_access_log_ipv6
2018-11-15 21:26:15 +03:00
Andrey Zelenkov
cf1f84b67c Tests: print path to unit.log file when it was saved. 2018-11-13 18:56:18 +03:00
Andrey Zelenkov
4d7f708b25 Tests: leave unit.log in case of error or failure. 2018-11-13 18:51:55 +03:00
Sergey Kandaurov
3061e8333d Tests: provide openssl.conf in test_tls_certificate_key_ec.
Previously, test failed if openssl was unable to load config info,
or the system's openssl.cnf was picked up, which is wrong as well.
2018-10-18 18:46:21 +03:00
Valentin Bartenev
029c1a9f50 Renamed "go" application type to "external".
There's nothing specific to Go language.  This type of application object can
be used to run any external application that utilizes libunit API.
2018-10-09 17:53:31 +03:00
Igor Sysoev
b5d4fc939e Disabled chunked transfer encoding for 204 responses. 2018-09-28 17:32:02 +03:00
Andrey Zelenkov
d0e428aace Tests: TLS tests. 2018-09-20 16:34:34 +03:00
Valentin Bartenev
510c2e15c5 Python: adjusted input.read(size) argument value interpretation.
Previously, passing 0 resulted in reading the whole body and all negative
values raised an exception.

Now the behaviour is in consistentance with io.RawIOBase.read() interface,
and passing 0 returns empty (byte) string, while -1 results in reading the
whole body.
2018-09-20 16:04:49 +03:00
Andrey Zelenkov
8065ba84aa Tests: test_settings_header_read_timeout_update adjusted. 2018-09-17 19:07:29 +03:00
Andrey Zelenkov
511a0fa760 Tests: used relative path for configuration. 2018-09-06 20:18:33 +03:00