Skip to content

[net_unittests] Add 1µs delay for cookie timestamps - #5216

Merged
kaidokert merged 1 commit into
youtube:25.lts.1+from
msolya:fix_net_test_2
Apr 7, 2025
Merged

kaidokert merged 1 commit into
youtube:25.lts.1+from
msolya:fix_net_test_2

Conversation

@msolya

@msolya msolya commented Mar 27, 2025

Copy link
Copy Markdown
Collaborator

b/219056504

Inserted a 1 microsecond delay in tests to ensure that cookies get distinct LastUpdateDate timestamps. This prevents operations from occurring in the same timestamp unit in high-performance environments, which could cause the test to fail.

@msolya
msolya requested a review from amurovanyi March 27, 2025 09:37

@amurovanyi amurovanyi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@andrewsavage1

Copy link
Copy Markdown
Contributor

@kaidokert where do we stand on filtering tests vs making changes to upstream files? This change doesn't seem like a good idea IMO

@msolya

msolya commented Mar 28, 2025

Copy link
Copy Markdown
Collaborator Author

@kaidokert where do we stand on filtering tests vs making changes to upstream files? This change doesn't seem like a good idea IMO

Thanks for the feedback. I'd like to add that this test can potentially fail on other high-performance platforms as well, due to rapid execution, not just on Xbox.

@kaidokert

Copy link
Copy Markdown
Contributor

@kaidokert where do we stand on filtering tests vs making changes to upstream files? This change doesn't seem like a good idea IMO

Couple of comments on this

  • This is on a maintenance branch, i'm less concerned about upstream changes here, as it's not actively increasing the diff in our mainline code

  • The Cookiemonster timing tests have had a lot of timing related flakiness issues for both us and Chromium, it looks like the test code is actually broken/unreliable. Chromium bug tracker has a lot of similar flakiness issues

  • The workaround looks like a sensible way to get around it

  • Ideally we should send a patch to Chromium upstream as well, the code is unchanged in Chromium trunk

  • I think an even cleaner fix would be to update the whole test suite to use simulated timer in a task environment, e.g. base::test::TaskEnvironment(base::test::TaskEnvironment::TimeSource::MOCK_TIME) and FastForwardBy etc. or base::SimpleTestClock. That's a larger rewrite though

As is, i would land this to remove the flakiness source.

@kaidokert kaidokert added the on_device Trigger on-device tests label Apr 1, 2025
b/219056504

Inserted a 1 microsecond delay in tests to ensure that
cookies get distinct LastUpdateDate timestamps. This
prevents operations from occurring in the same timestamp
unit in high-performance environments, which could cause
the test to fail.
@kaidokert
kaidokert merged commit 552581e into youtube:25.lts.1+ Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on_device Trigger on-device tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants