fix(logging): replace structlog with stdlib logging to prevent broken pipe crashes
structlog fails with BrokenPipeError when stdout is redirected (e.g., background processes, Docker logs). Replace all structlog.get_logger() calls with logging.getLogger() and convert keyword-style log calls to %-format strings. Also removes stale Docs/tasks.md (2028 lines) and updates Robot Framework tests to match current API behavior.
This commit is contained in:
@@ -15,9 +15,9 @@ GET API
|
||||
RETURN ${resp}
|
||||
|
||||
POST API
|
||||
[Arguments] ${endpoint} ${payload}=${EMPTY} ${expected_status}=200 ${session}=auth
|
||||
[Arguments] ${endpoint} ${payload}=${NONE} ${expected_status}=200 ${session}=auth
|
||||
[Documentation] Perform an authenticated POST request with optional JSON payload.
|
||||
IF '${payload}' == '${EMPTY}'
|
||||
IF $payload is ${NONE}
|
||||
${resp}= POST On Session ${session} ${endpoint} expected_status=${expected_status}
|
||||
ELSE
|
||||
${resp}= POST On Session ${session} ${endpoint} json=${payload} expected_status=${expected_status}
|
||||
@@ -173,8 +173,8 @@ Get Scan Status
|
||||
|
||||
Search Anime
|
||||
[Arguments] ${query}
|
||||
[Documentation] GET /api/anime/search?q={query}.
|
||||
${resp}= GET API /api/anime/search?q=${query}
|
||||
[Documentation] GET /api/anime/search?query=${query}.
|
||||
${resp}= GET API /api/anime/search?query=${query}
|
||||
RETURN ${resp}
|
||||
|
||||
Add Series
|
||||
@@ -184,7 +184,7 @@ Add Series
|
||||
IF '${year}' != '${EMPTY}'
|
||||
Set To Dictionary ${payload} year=${year}
|
||||
END
|
||||
${resp}= POST API /api/anime/add ${payload} 201
|
||||
${resp}= POST API /api/anime/add ${payload} 202
|
||||
RETURN ${resp}
|
||||
|
||||
Get Series Details
|
||||
|
||||
@@ -42,13 +42,17 @@ Stop Aniworld Server
|
||||
Run Keyword And Ignore Error Remove File ${CURDIR}/../fixtures/server_stderr.log
|
||||
|
||||
Wait For Server
|
||||
[Documentation] Poll the health endpoint until the server responds with 200.
|
||||
[Documentation] Poll the health endpoint until the server responds.
|
||||
... Accepts 200 or 503 (not configured yet) as valid responses.
|
||||
... Retries every 1 second for up to 30 seconds.
|
||||
FOR ${i} IN RANGE 30
|
||||
${resp}= Run Keyword And Ignore Error
|
||||
... GET On Session anon /health expected_status=200
|
||||
... GET On Session anon /health expected_status=any
|
||||
IF '${resp}[0]' == 'PASS'
|
||||
RETURN
|
||||
${status_code}= Set Variable ${resp}[1].status_code
|
||||
IF ${status_code} == 200 or ${status_code} == 503
|
||||
RETURN
|
||||
END
|
||||
END
|
||||
Sleep 1s
|
||||
END
|
||||
@@ -96,15 +100,44 @@ Setup Master Password
|
||||
... scheduler_enabled=False
|
||||
... logging_level=INFO
|
||||
... backup_enabled=False
|
||||
${resp}= POST On Session anon /api/auth/setup json=${payload} expected_status=201
|
||||
Should Be Equal As Integers ${resp.status_code} 201
|
||||
${resp}= POST On Session anon /api/auth/setup json=${payload} expected_status=any
|
||||
IF '${resp.status_code}' == '429'
|
||||
# Rate limited - wait and retry once
|
||||
Sleep 6s
|
||||
${resp}= POST On Session anon /api/auth/setup json=${payload} expected_status=any
|
||||
END
|
||||
IF '${resp.status_code}' == '400'
|
||||
# Already configured - this is OK
|
||||
${json}= Convert String To Json ${resp.text}
|
||||
${detail}= Get Value From Json ${json} $.detail
|
||||
IF '${detail}[0]' == 'Master password already configured'
|
||||
RETURN
|
||||
END
|
||||
Fail Setup failed with 400: ${detail}
|
||||
END
|
||||
IF '${resp.status_code}' == '201'
|
||||
Should Be Equal As Integers ${resp.status_code} 201
|
||||
RETURN
|
||||
END
|
||||
Fail Unexpected status ${resp.status_code} from /api/auth/setup
|
||||
|
||||
Login And Get Token
|
||||
[Documentation] Log in with the master password and return the JWT access token.
|
||||
${payload}= Create Dictionary password=${SETUP_PASSWORD}
|
||||
${resp}= POST On Session anon /api/auth/login json=${payload} expected_status=200
|
||||
${resp}= POST On Session anon /api/auth/login json=${payload} expected_status=any
|
||||
IF '${resp.status_code}' == '429'
|
||||
# Rate limited - wait and retry once
|
||||
Sleep 6s
|
||||
${resp}= POST On Session anon /api/auth/login json=${payload} expected_status=any
|
||||
END
|
||||
IF '${resp.status_code}' != '200'
|
||||
${json}= Convert String To Json ${resp.text}
|
||||
${detail}= Get Value From Json ${json} $.detail
|
||||
Fail Login failed with ${resp.status_code}: ${detail}
|
||||
END
|
||||
${json}= Convert String To Json ${resp.text}
|
||||
${token}= Get Value From Json ${json} $.access_token
|
||||
Set Suite Variable ${TOKEN} ${token}[0]
|
||||
RETURN ${token}[0]
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user