Skip to content

[tests-only][full-ci] test: fix flaky grouped email notification - #12882

Open
anon-pradip wants to merge 8 commits into
owncloud:masterfrom
anon-pradip:test/fix-email-flaky
Open

anon-pradip wants to merge 8 commits into
owncloud:masterfrom
anon-pradip:test/fix-email-flaky

Conversation

@anon-pradip

@anon-pradip anon-pradip commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes two unrelated causes of failure in the grouped email notification tests (cliCommands suite).

1. Timezone (local only). The test built the expected expiry in UTC, but oCIS prints it in the server's timezone, so on a non-UTC host they never matched:

oCIS emailed "... expired at 2026-09-03 05:45:00" <- server timezone (+05:45)
test expected "... expired at 2026-09-03 00:00:00" <- UTC

The email body has no offset, so it can't be converted. Instead the expected value is rendered in the timezone from the mail's own Date header, which comes from the same message being asserted.

  • EmailContext.php - reads the mail's Date timezone and resolves %expiry_date_in_mail% after the mail is fetched.
  • FeatureContext.php - expiry is a DateTimeImmutable in UTC; %expiry_date_in_mail% is removed from the global substitutions.
  • SpacesContext.php - expiration dates from the Graph API are converted to UTC before taking the date, instead of slicing the server's local date.
  • bootstrap.php - pins PHP to UTC so every workspace behaves the same regardless of its php.ini.

2. Flakiness (CI). oCIS only evaluates expirations when a resource is accessed (#10966, #11690). The scenario never read the space after expiring the membership, so SpaceMembershipExpired was only published if an unrelated async handler happened to. emailNotification.feature now asserts the user "Brian" should not have a space called "New-Space", which forces the check and verifies the membership ended.

Related Issue

Motivation and Context

emailNotification.feature was flaky in CI and always failed locally on non-UTC machines.

How Has This Been Tested?

  • Locally and CI.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@kw-security

kw-security commented Sep 3, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@anon-pradip anon-pradip changed the title [tests-only][full-ci] test:start auth-bearer service separately instead of via OCIS_ADD_RUN… [tests-only][full-ci] test: fix flaky grouped email notification Sep 7, 2026
@anon-pradip
anon-pradip force-pushed the test/fix-email-flaky branch 9 times, most recently from 2e363b6 to a7407c1 Compare September 11, 2026 05:20
@anon-pradip
anon-pradip marked this pull request as ready for review September 11, 2026 05:45
@anon-pradip
anon-pradip requested a review from a team as a code owner September 11, 2026 05:45
PrajwolAmatya
PrajwolAmatya previously approved these changes Sep 11, 2026

@PrajwolAmatya PrajwolAmatya 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.

LGTM

Comment thread tests/acceptance/bootstrap/SpacesContext.php Outdated
Comment thread .github/workflows/acceptance-tests.yml Outdated
Comment thread tests/acceptance/bootstrap/EmailContext.php Outdated
Comment thread tests/acceptance/bootstrap/EmailContext.php Outdated
Comment thread tests/acceptance/bootstrap/FeatureContext.php Outdated
Comment thread tests/acceptance/TestHelpers/HttpRequestHelper.php Outdated
Comment thread tests/acceptance/TestHelpers/HttpRequestHelper.php Outdated
Comment thread tests/acceptance/TestHelpers/HttpRequestHelper.php Outdated
Comment thread tests/acceptance/TestHelpers/HttpRequestHelper.php Outdated

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants