You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/mock_server/README.md
+31-13Lines changed: 31 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,28 +14,46 @@ Python 3.5+ required.
14
14
* Have the cert/key ready. The script now using `../resources/unittests.crt`, you can either just run the script within this directory, which will find the certificates and key from the related path, or you can use your own and change the code coordinately.
15
15
* Run python. `python3 ./server.py`.
16
16
17
-
#### Echo
17
+
#### Endpoints
18
18
19
-
* Minor changed based on the example to response the headers of requests back within the headers from `/echo`.
20
-
* To test the server runs correctly, you can do `curl -k -v -H "foo:bar" https://localhost:3443/echo` and check the result.
19
+
##### `/echo` - Echo endpoint (default)
21
20
22
-
#### Download test
21
+
Echoes back request headers and body as JSON.
23
22
24
-
* To test download, when `:path` is `/downloadTest`, server will response a repeated string with length `self.download_test_length`, which is 2,500,000,000 now. It will be repeats of sting "This is CRT HTTP test."
25
-
* To test the server runs correctly, you can do `curl -k -v -H "foo:bar" https://localhost:3443/downloadTest` and check the result.
##### `/echo` with `x-repeat-data` header - Download test
28
28
29
-
* Simulate a slow connection when `:path` is `/slowConnTest`. The speed is controlled by `out_bytes_per_second`. Default speed is 900 B/s, which will send 900 bytes of data and wait a sec to send new 900 bytes of data.
29
+
Sends repeated test pattern of specified size (in bytes).
* To test upload, when `:method` is `POST` or `PUT`, server will response the length received from response body
34
-
* To test the server runs correctly, you can do `curl -k -X POST -F'data=@upload_test.txt' https://localhost:3443/upload_test` where `upload_test.txt` is file to upload.
36
+
##### `/echo` with `x-repeat-data` + `x-slow-response` headers - Slow connection test
37
+
38
+
Sends repeated data throttled to ~900 bytes/sec (for timeout testing).
39
+
40
+
```bash
41
+
# Download 5MB slowly at default speed (900 bytes/sec)
0 commit comments