Skip to content

[ci] fix flaky test due to time shift#30030

Merged
iBotPeaches merged 1 commit into
masterfrom
flaky-time-test
May 21, 2026
Merged

[ci] fix flaky test due to time shift#30030
iBotPeaches merged 1 commit into
masterfrom
flaky-time-test

Conversation

@iBotPeaches

Copy link
Copy Markdown
Member

Problem

I was working at night my time (8pm Eastern) - usually I work at 5-7am Eastern and I had a test failure that was so odd.

[00:03:04]: ▸ 1) Fastlane Fastlane::FastFile Xcodebuild Integration works with a destination list
xcodebuild -destination \"name=iPhone 5s,OS=8.1\" -destination \"name=iPhone 4,OS...nneradmin/Library/Logs/fastlane/xcbuild/2026-05-10/5952/xcodebuild.log' | xcpretty --color --simple"
[00:03:04]: ▸ got: "set -o pipefail && xcodebuild -destination \"name=iPhone 5s,OS=8.1\" -destination \"name=iPhone 4,OS...nneradmin/Library/Logs/fastlane/xcbuild/2026-05-11/5952/xcodebuild.log' | xcpretty --color --simple"

The issue was the day changed between the assertions and execution (I guess the time changing).

Solution

  1. We change a static reference into a let block so its resolved at runtime (not start time). This means even though we are mocking time - they will be closer together. Since test suite can take 1-10min

  2. We mock Time

@lacostej

Copy link
Copy Markdown
Collaborator

Number of days since a time-related bug was discovered: -1 ;)

@iBotPeaches iBotPeaches merged commit fd9ba96 into master May 21, 2026
14 checks passed
@iBotPeaches iBotPeaches deleted the flaky-time-test branch May 21, 2026 11:02

@github-actions github-actions Bot 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.

Hey @iBotPeaches 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a month, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀"

@github-actions github-actions Bot 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.

Congratulations! 🎉 This was released as part of fastlane 2.235.0 🚀

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