Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for the HTTP tracker #159

Closed
Tracked by #158
josecelano opened this issue Jan 16, 2023 · 0 comments · Fixed by #162
Closed
Tracked by #158

Add tests for the HTTP tracker #159

josecelano opened this issue Jan 16, 2023 · 0 comments · Fixed by #162
Labels
Quality & Assurance Relates to QA, Testing, and CI

Comments

@josecelano
Copy link
Member

Parent issue: #158

@josecelano josecelano added the Quality & Assurance Relates to QA, Testing, and CI label Jan 16, 2023
@josecelano josecelano changed the title Add tests for the HTTP Tracker Add tests for the HTTP tracker Jan 16, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 17, 2023
… running

Add a communication channel to wait until the new job is running.
This is specially useful for testing, becuase tests need the HTTP server
up and running before making requests.
@josecelano josecelano linked a pull request Jan 17, 2023 that will close this issue
5 tasks
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 17, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 20, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 20, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 20, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 20, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 23, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 24, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 24, 2023
It will be used to deserialize bytes from HTTP tracker announce compact
responses. For exmaple:

```
pub peers: Vec<u8>,
```
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 24, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 25, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 25, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 25, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 26, 2023
We need it to get the address of the HTTP client we use in tests.
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 26, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 26, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 26, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 26, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 27, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 30, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 30, 2023
We will use one mod per type of request and response.
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 30, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 30, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 30, 2023
…follow new scrape conventions

Deserialization from bencoded bytes for announce and scrape request is
done in two phases. First using `serde_bencode::from_bytes` and later
with a custom parser. The reason is the `serde_bencode` crate does not
allow direct deserialization for the strcuts we need.

The strcut resulting from the first deserialization done by
`serde_bencode` is the `DeserializedCompact` and the second one just
`Compact`. So the prefix `Deserialized` is used when the bytes in the
reponse body are converted into a struct.
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 30, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 31, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 31, 2023
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Feb 1, 2023
josecelano added a commit that referenced this issue Feb 1, 2023
c46e417 test(http): [#159] add more tests for scrape request (Jose Celano)
c24d744 refactor(test): [#159] refactor tests for announce request (Jose Celano)
7ee588a refactor(test): [#159] refactor tests for scrape request (Jose Celano)
c89a1f3 fix(http): [#159] minor text fixes (Jose Celano)
2754189 refactor(http): [#159] rename struct in announce responses to follow new scrape conventions (Jose Celano)
dc304e7 test(http): [#159] scaffolding to test scrape responses in http tracker (Jose Celano)
d7610ef refactor(http): [#159] move mods to folders (Jose Celano)
953a100 docs(http): [#159] add links to info about scrape requests (Jose Celano)
fcd60e2 fix(http): Display impl for tracker::peer:ID (Jose Celano)
e1765f3 fix: new clippy errors (Jose Celano)
badb791 test(http): [#159] add tests for announce request in private mode (Jose Celano)
11492a3 test(http): [#159] add tests for announce request in whitelisted mode (Jose Celano)
86155d6 refactor(http): improve readability (Jose Celano)
452b81a test(http): [#159] add tests for assigning IP to peers in announce request (Jose Celano)
5cc2ac1 refactor(http): [#159] add dependency local-ip-address (Jose Celano)
080f3c4 test(http): [#159] add tests for uptadint statistics after announce request (Jose Celano)
85a4894 test(http): [#159] add test for default announce response format (Jose Celano)
3fce688 refactor(http): extract converter (Jose Celano)
96fb56c  test(http): [#159] add test for compact announce response (Jose Celano)
8e5c992 refactor(http): [#159] add dependency: serde_bytes (Jose Celano)
8ae4928 test(http): [#159] add test for invalid announce request params (Jose Celano)
62dbffa test(http): [#159] add test for missing announce req params in http tracker (Jose Celano)
7fa8ec8 test(http): add test for failing convertion of peer Id into String (Jose Celano)
ca8fc22 test(http): [#159] add tests for public http tracker (Jose Celano)
dd38045 refactor(http): [#159] extract test builders (Jose Celano)
1a558d2 test(http): [#159] add tests for public http tracker (Jose Celano)
41ad07f refactor(http): [#159] add dependencies: serde_urlencoded and serde_repr (Jose Celano)
3449202 test(http): [#159] HTTP tracker tests scaffolding (Jose Celano)
c26b356 feat(http): [#159] during HTTP tracker setup wait until job is running (Jose Celano)

Pull request description:

  Add tests for the HTTP tracker.

  - [x] Tests for request authentication.
  - [x] Tests for `announce` request.
  - [x] Tests for `scrape` request.

  These subtasks require discussion and a formal definition of the solution we will implement. I will create new issues for them:

  - [ ] Fix empty peer ID in response. Return UTF8 representation of the bytes, for example: `-qB000000000000000004`.
  - [ ] [Review the process of selecting the client/peer IP from the `X-Forwarded-For` header when the tracker is behind a proxy](#163). More info [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For#selecting_an_ip_address).

  **UPDATE**: 01-02-2023

ACKs for top commit:
  josecelano:
    ACK c46e417

Tree-SHA512: 0a6101941cdcef5eb9309dce2726ea5f4a865ccdf695f8551b02859821c5068e76b16e989cdb7bbd4a1e3484709995d8fbebc843cdb6951e293882ba11e82cde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Quality & Assurance Relates to QA, Testing, and CI
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant