Commit Graph

128 Commits

Author SHA1 Message Date
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
Tiago Natel de Moura 08b765ae42 Tests: Added rootfs tests. 2020-05-28 14:59:52 +01: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 ce4a2bbd05 Tests: style. 2020-05-15 04:20:56 +01: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 6a9a4fe0d4 Tests: introduced module version specification in prerequisites. 2020-04-24 05:08:56 +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 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
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
Andrei Zeliankou 5f2d07019c Tests: increase default "read_timeout" to 60s in message_read(). 2020-03-27 15:48:39 +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
Max Romanov 5296be0b82 Using disk file to store large request body.
This closes #386 on GitHub.
2020-03-12 17:54:29 +03:00
Andrei Zeliankou 961674af42 Tests: skip "last message send failed" alerts globally. 2020-03-12 13:44:30 +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 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
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
Max Romanov a427ecd4c5 Go: installing go module for tests into build directory. 2019-12-24 17:59:48 +03: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 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
Andrey Zelenkov ed3298a3c6 Tests: fixed operator in http.py. 2019-11-08 14:04:32 +03:00
Andrey Zelenkov 47436e9be5 Tests: improved handshake for websocket tests. 2019-10-23 16:26:06 +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
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
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
Max Romanov 2b8cab1e24 Java: introducing websocket support. 2019-09-05 15:27:32 +03:00