test(images): cover retry loop and validator edge cases

Addresses P1 feedback from QA verdict on 11108b3:
- Retry-path tests: 429-then-200, 500-then-200, persistent-502 exhausts
  all attempts and throws.
- Validator guardrail test: validate_credentials_detailed() asserts
  wp_remote_post is never called, locking in the non-destructive probe
  contract so no "Test Connection" click ever burns image-gen budget.
- Validator edge case: missing account_id returns 'account_id_empty'
  without touching the network.
- Bootstrap retry delay set to 0 in tests so the new retry-loop tests
  don't spend real wall time in sleep(). Production value unchanged
  (PRAUTOBLOGGER_RETRY_BASE_DELAY_SECONDS = 2 in prautoblogger.php).

Risk flags:
- No code under test changed. Same provider diff as 11108b3; this
  commit is purely additional coverage + a zero-impact bootstrap tweak.

Agent-Session: cowork-2026-04-15-image-pipeline-commit-1a-qa-fixup
This commit is contained in:
peptiderepo
2026-04-15 10:14:38 +07:00
parent 11108b3bb5
commit c8236189cd
2 changed files with 180 additions and 1 deletions

View File

@@ -37,7 +37,9 @@ if ( ! defined( 'PRAUTOBLOGGER_API_TIMEOUT_SECONDS' ) ) {
define( 'PRAUTOBLOGGER_API_TIMEOUT_SECONDS', 30 );
}
if ( ! defined( 'PRAUTOBLOGGER_RETRY_BASE_DELAY_SECONDS' ) ) {
define( 'PRAUTOBLOGGER_RETRY_BASE_DELAY_SECONDS', 1 );
// Zero in the test bootstrap so retry-path tests don't spend real wall
// time in sleep(). Production default is 2 (see prautoblogger.php).
define( 'PRAUTOBLOGGER_RETRY_BASE_DELAY_SECONDS', 0 );
}
// Default model slugs used by Publisher, ChiefEditor, Activator, settings UI.