Skip to content

Comments

test(quickstart): use flexible regex for WordPress REST API link header [skip buildkite]#8133

Merged
rfay merged 2 commits intoddev:mainfrom
rfay:20260212_rfay_wp_quickstart_test
Feb 12, 2026
Merged

test(quickstart): use flexible regex for WordPress REST API link header [skip buildkite]#8133
rfay merged 2 commits intoddev:mainfrom
rfay:20260212_rfay_wp_quickstart_test

Conversation

@rfay
Copy link
Member

@rfay rfay commented Feb 12, 2026

The Issue

WordPress bats tests were brittle because they matched the exact REST API discovery URL in the link header (/index.php?rest_route=/ vs /wp-json/). A WordPress behavior change seems to have broken this test in the last couple of days, see https://github.com/ddev/ddev/actions/runs/21928290932/job/63336208374

How This PR Solves The Issue

  • exact assert_output --partial matches on the link header with assert_line --regexp that matches the essential parts (site hostname and rel="https://api.w.org/") without pinning the REST API URL format.
  • Use simpler curl -I instead of adding -v, which made the output hard to read. The -v was apparently debugging from an earlier problem.
  • The bedrock test does a 302 instead of 200. I'm not sure how this worked before.

Manual Testing Instructions

Run the WordPress bats tests:

bats docs/tests/wordpress.bats

Automated Testing Overview

This modifies the existing bats test assertions to be more resilient. No new tests needed — the change makes existing tests less sensitive to upstream WordPress permalink behavior.

Release/Deployment Notes

No impact. Test-only change.

…ip buildkite]

## The Issue

WordPress bats tests were brittle because they matched the exact REST API
discovery URL in the `link` header (`/index.php?rest_route=/` vs `/wp-json/`).
A WordPress behavior change (enabling pretty permalinks by default) broke the
tests.

## How This PR Solves The Issue

Replace exact `assert_output --partial` matches on the `link` header with
`assert_line --regexp` that matches the essential parts (site hostname and
`rel="https://api.w.org/"`) without pinning the REST API URL format.

## Manual Testing Instructions

Run the WordPress bats tests:
```
bats docs/tests/wordpress.bats
```

## Automated Testing Overview

This modifies the existing bats test assertions to be more resilient. No new
tests needed — the change makes existing tests less sensitive to upstream
WordPress permalink behavior.

## Release/Deployment Notes

No impact. Test-only change.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@rfay rfay marked this pull request as ready for review February 12, 2026 18:09
@rfay rfay requested a review from a team as a code owner February 12, 2026 18:09
@rfay rfay requested a review from stasadev February 12, 2026 18:10
Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I don't know what happened here.

@rfay rfay merged commit eebbf7b into ddev:main Feb 12, 2026
17 checks passed
@rfay rfay deleted the 20260212_rfay_wp_quickstart_test branch February 12, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants