Fix integration/README.md and CONTRIBUTING.md prerequisites

This commit is contained in:
fpinto 2024-10-04 18:13:36 +02:00
parent a854201606
commit 949963cfc8
No known key found for this signature in database
GPG Key ID: F4F06B068FB00692
2 changed files with 28 additions and 21 deletions

View File

@ -47,10 +47,10 @@ Once your setup is ready, just build the project:
```shell
$ cargo build
Compiling hurl_core v2.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurl_core)
Compiling hurl_core v6.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurl_core)
...
Compiling hurlfmt v2.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurlfmt)
Compiling hurl v2.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurl)
Compiling hurlfmt v6.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurlfmt)
Compiling hurl v6.0.0-SNAPSHOT (/Users/jc/Documents/Dev/hurl/packages/hurl)
Finished dev [unoptimized + debuginfo] target(s) in 2.53s
```
@ -61,7 +61,7 @@ $ cargo test --lib
```
Hurl has a big suite of [integration tests]. To run the integration tests, you'll need Python 3.6+. You can use a [virtual environment] and install the dependencies needed
Hurl has a big suite of [integration tests]. To run the integration tests, you'll need Python 3.9+. You can use a [virtual environment] and install the dependencies needed
by the tests suite:
```shell
@ -73,15 +73,21 @@ $ pip install --requirement bin/requirements-frozen.txt
Then, you can launch our local server (used to test Hurl features):
```shell
$ cd integration
$ python3 server.py >server.log 2>&1 &
$ python3 ssl/server.py >server-ssl.log 2>&1 &
$ squid_conf="http_access allow all\nhttp_port 3128\nrequest_header_add From-Proxy Hello\nreply_header_add From-Proxy Hello"
$ (echo "${squid_conf}" | squid -d 2 -N -f /dev/stdin > proxy.log 2>&1) &
$ cd integration/hurl
$ python3 server.py > server.log 2>&1 &
$ python3 tests_ssl/ssl_server.py 8001 tests_ssl/certs/server/cert.selfsigned.pem false > server-ssl-selfsigned.log 2>&1 &
$ python3 tests_ssl/ssl_server.py 8002 tests_ssl/certs/server/cert.pem false > server-ssl-signedbyca.log 2>&1 &
$ python3 tests_ssl/ssl_server.py 8003 tests_ssl/certs/server/cert.selfsigned.pem true > server-ssl-client-authent.log 2>&1 &
$ python3 tests_unix_socket/unix_socket_server.py > server-unix-socket.log 2>&1 &
$ squid_conf="cache deny all\ncache_log /dev/null\naccess_log /dev/null\nhttp_access allow all\nhttp_port 127.0.0.1:3128\nrequest_header_add From-Proxy Hello\nreply_header_add From-Proxy Hello"
$ (echo -e "${squid_conf}" | sudo squid -d 2 -N -f /dev/stdin | sudo tee proxy.log 2>&1) &
$ jobs
[1] running python3 server.py > server.log 2>&1
[2] - running python3 ssl/server.py > server-ssl.log 2>&1
[3] + running echo "${squid_conf}" | squid -d 2 -N -f /dev/stdin > proxy.log 2>&1
[1] Running ( echo -e "${squid_conf}" | sudo squid -d 2 -N -f /dev/stdin | sudo tee build/proxy.log 2>&1 ) &
[2] Running python3 server.py > server.log 2>&1 &
[3] Running python3 tests_ssl/ssl_server.py 8001 tests_ssl/certs/server/cert.selfsigned.pem false > server-ssl-selfsigned.log 2>&1 &
[4]-Running python3 tests_ssl/ssl_server.py 8002 tests_ssl/certs/server/cert.pem false > server-ssl-signedbyca.log 2>&1 &
[5]+Running python3 tests_ssl/ssl_server.py 8003 tests_ssl/certs/server/cert.selfsigned.pem true > server-ssl-client-authent.log 2>&1 &
```
You can check [the integration `README`] for more details
@ -92,7 +98,7 @@ Now, you can follow these steps when you make changes:
2. Run Clippy `cargo clippy`
3. Format `cargo fmt`
4. Run units tests `cargo test --lib`
5. Run integration tests `cd integration && python3 integration.py`
5. Run integration tests `cd integration/hurl && python3 integration.py`
Et voilà 🎉!

View File

@ -30,7 +30,7 @@ $ pip install --requirement bin/requirements-frozen.txt
### Proxy
Some integration tests need a proxy. You can use [mitmproxy] or [squid].
Some integration tests need a proxy. Given our cross-platform needs, we selected [squid] rather than [mitmproxy].
### Start local server
@ -40,6 +40,8 @@ local test server and proxy. Once launch, there is:
- a Flask server instance listening on <http://localhost:8000>
- a Flask server instance listening on <https://localhost:8001>
- a Flask server instance listening on <https://localhost:8002>
- a Flask server instance listening on <https://localhost:8003>
- a Flask server instance listening on `build/unix_socket.sock`
- a HTTP proxy listening on <http://localhost:8888>
Now, everything is ready to run the integration tests!
@ -56,8 +58,8 @@ ensure that there is no regression even if a Hurl file doesn't follow a stricter
- [`hurl/tests_failed`]: every test must fail (exit code different from 0). Tests are syntactically correct, so the error
raised by the test is a runtime error.
- [`hurl/tests_error_parser`]: every test is not a syntactically correct Hurl file. We test here the parsing error message.
- [`hurl/ssl`]: tests SSL features (server and client certificates, etc...)
- [`hurl/unix_socket`]: tests Unix Socket
- [`hurl/tests_ssl`]: tests SSL features (server, client certificates and test files)
- [`hurl/tests_unix_socket`]: tests Unix Socket (server and test files)
Integration tests to test `hurlfmt` binary are grouped in `integration/hurlfmt` directory:
@ -90,10 +92,7 @@ is a JSON view of the Hurl source file and can serve to convert from/to Hurl for
To run all integration tests:
```shell
$ cd integration/hurl
$ python3 integration.py
$ cd integration/hurlfmt
$ python3 integration.py
$ bin/test/test_integ.sh
```
To run a particular integration test without any check:
@ -195,8 +194,10 @@ curl 'http://localhost:8000/include'
[`hurl/tests_ok_not_linted`]: /integration/hurl/tests_ok_not_linted
[`hurl/tests_failed`]: /integration/hurl/tests_failed
[`hurl/tests_error_parser`]: /integration/hurl/tests_error_parser
[`hurl/tests_ssl`]: /integration/hurl/tests_ssl
[`hurl/tests_unix_socket`]: /integration/hurl/tests_unix_socket
[`hurlfmt/tests_ok`]: /integration/hurlfmt/tests_ok
[`hurlfmt/tests_export`]: /integration/hurlfmt/tests_export
[`hurlfmt/tests_error_lint`]: /integration/hurlfmt/tests_error_lint
[`--verbose`]: /docs/manual.md#verbose
[`--very-verbose`]: /docs/manual.md#very-verbose
[`--very-verbose`]: /docs/manual.md#very-verbose