nodeinfo-test/README.md

126 lines
5.2 KiB
Markdown
Raw Permalink Normal View History

2023-10-01 13:36:43 +05:30
[![status-badge](https://ci.batsense.net/api/badges/89/status.svg)](https://ci.batsense.net/repos/89)
---
# Nodeinfo tests for ForgeFlux/ftest
## TODO
2023-10-01 14:16:00 +05:30
- [x] Write code to upload to ftest server
- [x] Package Docker container
- [x] Upload to Docker Hub
2023-10-01 13:36:43 +05:30
## Environment Variables
Please see [`.env_sample`](./.env_sample)
| NAME | Purpose | Example |
| ------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `FTEST_AUTH` | Authorization token for uploading test results to ftest server | a random-generated string that will be provided by ftest server |
| `FTEST_HOST` | The URL of the ftest's instance to which tests results should be uploaded | `http://localhost:5000`, if an ftest implementation is running on localhost at port 5000 |
| `FTEST_TARGET_HOST` | The URL of the implementation's instance against which tests will be run | `http://localhost:3000`, if Forgejo or any other Nodeinfo implementation is running on localhost at port 3000 |
## Usage
```bash
cp .env_sample .env # edit and populate .env with the right values
source .env
python run.py
```
### Docker
```bash
cp .env_sample .env # edit and populate .env with the right values
source .env
docker run \
-e FTEST_AUTH=$FTEST_AUTH \
-e FTEST_TARGET_HOST=$FTEST_TARGET_HOST \
-e FTEST_HOST=$FTEST_HOST forgeflux/nodeinfo-test
2023-10-01 13:36:43 +05:30
```
## Demo
### Successful run:
<details>
<summary>Please open to see logs</summary>
```bash
2023-10-01 14:15:28 +05:30
2023-10-01 14:11:52,711 - nodeinfo - INFO - Environment: FTEST_AUTH: aACGJUaWKbUAynhz54762jYC0lcTtIei
2023-10-01 14:11:52,711 - nodeinfo - INFO - Environment: FTEST_HOST: http://localhost:9000
2023-10-01 14:11:52,711 - nodeinfo - INFO - Environment: FTEST_TARGET_HOST: http://forgejo:7000
2023-10-01 14:11:52,711 - nodeinfo - INFO - Query nodeinfo: http://forgejo:7000/.well-known/nodeinfo
2023-10-01 14:11:52,715 - nodeinfo - DEBUG - nodeinfo response:
2023-10-01 13:36:43 +05:30
2023-10-01 14:15:28 +05:30
STATUS: 200
HEADERS:
{'Cache-Control': 'max-age=0, private, must-revalidate, no-transform', 'Content-Type': 'application/json;charset=utf-8', 'Set-Cookie': 'i_like_gitea=3dfde1a36bac742e; Path=/; HttpOnly; SameSite=Lax, _csrf=mItNQEJtk8C_SAffDQzjbRFl0_s6MTY5NjE0OTcxMjcxNDI5OTg3NQ; Path=/; Max-Age=86400; HttpOnly; SameSite=Lax', 'X-Frame-Options': 'SAMEORIGIN', 'Date': 'Sun, 01 Oct 2023 08:41:52 GMT', 'Content-Length': '115'}
RESPONSE PAYLOAD:
{'links': [{'href': 'http://forgejo:7000/api/v1/nodeinfo', 'rel': 'http://nodeinfo.diaspora.software/ns/schema/2.1'}]}
2023-10-01 14:11:52,715 - nodeinfo - INFO - [SUCCESS] nodeinfo query response is HTTP 200
2023-10-01 14:11:52,715 - nodeinfo - INFO - [SUCESS] links passed schema validation
2023-10-01 14:11:53,387 - nodeinfo - INFO - [SUCESS] passed Nodeinfo 2.1 schema validation
===============
2023-10-01 14:11:53,387 - nodeinfo - INFO - All tests passed
2023-10-01 14:11:53,396 - nodeinfo - INFO - Summary:
2023-10-01 14:11:53,396 - nodeinfo - INFO - Successful tests:
2023-10-01 14:11:53,396 - nodeinfo - INFO - [OK] test_links
2023-10-01 14:11:53,396 - nodeinfo - INFO - [OK] test_schema_Nodeinfo_2.1
2023-10-01 13:36:43 +05:30
```
</details>
### Failed run:
<details>
<summary>Please open to see logs</summary>
```bash
2023-10-01 14:15:28 +05:30
14:13 (venv) atm@lab nodeinfo ±|master ✗|→ python run.py
2023-10-01 14:13:54,964 - nodeinfo - INFO - Environment: FTEST_AUTH: aACGJUaWKbUAynhz54762jYC0lcTtIei
2023-10-01 14:13:54,964 - nodeinfo - INFO - Environment: FTEST_HOST: http://localhost:9000
2023-10-01 14:13:54,973 - nodeinfo - INFO - Environment: FTEST_TARGET_HOST: http://forgejo:7000
2023-10-01 14:13:54,973 - nodeinfo - INFO - Query nodeinfo: http://forgejo:7000/.well-known/nodeinfo
2023-10-01 14:13:54,977 - nodeinfo - DEBUG - nodeinfo response:
STATUS: 200
HEADERS:
{'Cache-Control': 'max-age=0, private, must-revalidate, no-transform', 'Content-Type': 'application/json;charset=utf-8', 'Set-Cookie': 'i_like_gitea=4cb5cb90cf023e54; Path=/; HttpOnly; SameSite=Lax, _csrf=CXHunQ6_4ADS51avMV3FZQPSAdY6MTY5NjE0OTgzNDk3NjU2ODY0Nw; Path=/; Max-Age=86400; HttpOnly; SameSite=Lax', 'X-Frame-Options': 'SAMEORIGIN', 'Date': 'Sun, 01 Oct 2023 08:43:54 GMT', 'Content-Length': '115'}
RESPONSE PAYLOAD:
{'links': [{'href': 'http://forgejo:7000/api/v1/nodeinfo', 'rel': 'http://nodeinfo.diaspora.software/ns/schema/2.1'}]}
2023-10-01 14:13:54,977 - nodeinfo - INFO - [SUCCESS] nodeinfo query response is HTTP 200
2023-10-01 14:13:54,977 - nodeinfo - INFO - [SUCESS] links passed schema validation
2023-10-01 14:13:54,977 - nodeinfo - ERROR - '1.0'
===============
2023-10-01 14:13:54,977 - nodeinfo - INFO - Partial success. 1 out of 2 tests passed
2023-10-01 14:13:54,977 - nodeinfo - INFO - Summary:
2023-10-01 14:13:54,977 - nodeinfo - INFO - Successful tests:
2023-10-01 14:13:54,977 - nodeinfo - INFO - [OK] test_links
2023-10-01 14:13:54,977 - nodeinfo - ERROR -
Failed tests:
2023-10-01 13:36:43 +05:30
2023-10-01 14:15:28 +05:30
2023-10-01 14:13:54,977 - nodeinfo - ERROR - [FAIL] test_schema_Nodeinfo_2.1 failed with error:
'1.0'
-----
2023-10-01 13:36:43 +05:30
```
</details>