ftest tests for the Nodeinfo protocol
Find a file
Renovate Bot 182ad57556
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
chore(deps): update dependency frozendict to v2.4.5
2024-10-06 15:05:38 +00:00
.reuse feat: init 2023-10-01 13:36:43 +05:30
LICENSES feat: init 2023-10-01 13:36:43 +05:30
.dockerignore feat: init Docker pkg 2023-10-01 13:55:54 +05:30
.env_sample fix: rm FTEST_USER. It is irrelevant for this test 2023-10-01 13:56:24 +05:30
.gitignore feat: init 2023-10-01 13:36:43 +05:30
.woodpecker.yml feat: init Docker pkg 2023-10-01 13:55:54 +05:30
Dockerfile feat: init Docker pkg 2023-10-01 13:55:54 +05:30
README.md doc: check all TODO items 2023-10-01 14:16:13 +05:30
renovate.json Add renovate.json 2024-06-02 13:46:07 +00:00
requirements.txt chore(deps): update dependency frozendict to v2.4.5 2024-10-06 15:05:38 +00:00
run.py feat: upload to ftest server 2023-10-01 14:15:06 +05:30

status-badge


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'
-----