Skip to content

test: match expected failures that Behat reports with a line suffix - #41916

Open
oc-tmueller wants to merge 1 commit into
masterfrom
fix/run-sh-expected-failure-line-suffix
Open

oc-tmueller wants to merge 1 commit into
masterfrom
fix/run-sh-expected-failure-line-suffix

Conversation

@oc-tmueller

Copy link
Copy Markdown
Contributor

run.sh checks that every scenario in EXPECTED_FAILURES_FILE really failed with

echo "${FAILED_SCENARIO_PATHS}" | grep ${SUITE_SCENARIO}$

so the failed path has to end the line. Behat 3.34 prints every failed scenario with the line of the failed step appended:

--- Failed scenarios:

    /src/tests/acceptance/features/cliExternalStorage/filesExternalWebdavOwncloud.feature:67 (on line 77)

The grep then never matches. Every expected failure is reported as "expected to fail but did not fail", and the run fails even though exactly the listed scenarios failed. The forward check is unaffected, because it strips everything after the first space. Behat 3.13 (used for 10.16) printed these paths without the suffix, which is why it worked there.

This showed up in owncloud-docker/server#738, which runs core's acceptance tests from the 11.0.1 -qa tarball against the Docker image. Its 11.0.1 CLI jobs failed this way; the 10.16.6 jobs, with Behat 3.13, passed with lists of the same kind. That PR patches the extracted run.sh the same way as this one.

The fix allows an optional (on line N) suffix. It still keeps file.feature:9 distinct from file.feature:902, as the comment above it requires. Checked by hand: comments.feature:9 matches both …comments.feature:9 and …comments.feature:9 (on line 15), and does not match …comments.feature:902.

🤖 Generated with Claude Code

Behat can print a failed scenario as 'features/suite/file.feature:9
(on line 15)'. Behat 3.34 does so for every failed scenario, where 3.13
printed the bare path. run.sh checks that every listed expected failure
really failed by grepping for the path at the end of the line, so with
Behat 3.34 each expected failure was reported as 'expected to fail but
did not fail' and the run failed. Allow the optional suffix, keeping
file.feature:9 distinct from file.feature:902.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <323649642+oc-tmueller@users.noreply.github.com>
@oc-tmueller
oc-tmueller requested a review from a team as a code owner October 23, 2026 08:57

@phil-davis phil-davis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. This has always been a bit of a pain, because we have to parse the human-readable text output of the test run, rather than being able to get any well-specified data format holding the test results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants