ftest tests for the Nodeinfo protocol
Aravinth Manivannan
3e17b6dad8
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
Reviewed-on: #13 |
||
---|---|---|
.reuse | ||
LICENSES | ||
.dockerignore | ||
.env_sample | ||
.gitignore | ||
.woodpecker.yml | ||
Dockerfile | ||
README.md | ||
renovate.json | ||
requirements.txt | ||
run.py |
Nodeinfo tests for ForgeFlux/ftest
TODO
- Write code to upload to ftest server
- Package Docker container
- Upload to Docker Hub
Environment Variables
Please see .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
cp .env_sample .env # edit and populate .env with the right values
source .env
python run.py
Docker
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
Demo
Successful run:
Please open to see logs
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:
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
Failed run:
Please open to see logs
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 14:13:54,977 - nodeinfo - ERROR - [FAIL] test_schema_Nodeinfo_2.1 failed with error:
'1.0'
-----