-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[cookie-store] Deflake service worker registration #18324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Instead of attempting to unregister previously installed service workers at the beginning of a test, use `add_completion_callback` to unregister them at test completion. This will deflake the tests when they are run multiple times without restarts (`--rerun`). The alternative is to do what many tests in service-workers do: unregister service workers at the start, but wait for newly installed service workers to become activated and use `registration.active` instead of `registration.installing`, which is a bit more complex.
There are a few other tests in this directory that can benefit from the same treatment, but they seem to be flaky both with and without the patch (there's probably some other existing flakiness). I'll perhaps send out a part 2 PR for those so that this PR can be green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine.
I think we went with the "unregistered first" pattern to defend against leftover data from a failed/flaky test that didn't clean up, but if this improves things in practice then let's do it.
That does work in principle. In practice, I've observed that registration of a service worker from scratch is initially in the "installing" state, whereas registration of a sw immediately after unregistering the same one is in the "active" state right away. Tests in In general, I think it's safe to assume that tests start from a clean state and strive to make sure tests clean up after themselves regardless of the results. |
This is a follow-up to #18324 This change by itself isn't sufficient to deflake the two tests.
This is a follow-up to #18324 This change by itself isn't sufficient to deflake the two tests.
…ing service worker tests, a=testonly Automatic update from web-platform-tests [cookie-store] Deflake service worker registration (part 2) This is a follow-up to web-platform-tests/wpt#18324 This change by itself isn't sufficient to deflake the two tests. -- [cookie-store] Attempt to deflake two tests Move the event handler registration to the top scope of the service worker (Chrome warning: "Event handler of ... event must be added on the initial evaluation of worker script."). -- wpt-commits: a13797b678be16d1bec8cae0a8288e6101569cae, 909a1049b9431ae7e1a64c871b5c6822f0a90367 wpt-pr: 18340
…ing service worker tests, a=testonly Automatic update from web-platform-tests [cookie-store] Deflake service worker registration (part 2) This is a follow-up to web-platform-tests/wpt#18324 This change by itself isn't sufficient to deflake the two tests. -- [cookie-store] Attempt to deflake two tests Move the event handler registration to the top scope of the service worker (Chrome warning: "Event handler of ... event must be added on the initial evaluation of worker script."). -- wpt-commits: a13797b678be16d1bec8cae0a8288e6101569cae, 909a1049b9431ae7e1a64c871b5c6822f0a90367 wpt-pr: 18340
This is a follow-up to web-platform-tests#18324 This change by itself isn't sufficient to deflake the two tests.
…ing service worker tests, a=testonly Automatic update from web-platform-tests [cookie-store] Deflake service worker registration (part 2) This is a follow-up to web-platform-tests/wpt#18324 This change by itself isn't sufficient to deflake the two tests. -- [cookie-store] Attempt to deflake two tests Move the event handler registration to the top scope of the service worker (Chrome warning: "Event handler of ... event must be added on the initial evaluation of worker script."). -- wpt-commits: a13797b678be16d1bec8cae0a8288e6101569cae, 909a1049b9431ae7e1a64c871b5c6822f0a90367 wpt-pr: 18340 UltraBlame original commit: e2ca31539fd1be204f9d095fa98d77521b82329a
…ing service worker tests, a=testonly Automatic update from web-platform-tests [cookie-store] Deflake service worker registration (part 2) This is a follow-up to web-platform-tests/wpt#18324 This change by itself isn't sufficient to deflake the two tests. -- [cookie-store] Attempt to deflake two tests Move the event handler registration to the top scope of the service worker (Chrome warning: "Event handler of ... event must be added on the initial evaluation of worker script."). -- wpt-commits: a13797b678be16d1bec8cae0a8288e6101569cae, 909a1049b9431ae7e1a64c871b5c6822f0a90367 wpt-pr: 18340 UltraBlame original commit: e2ca31539fd1be204f9d095fa98d77521b82329a
…ing service worker tests, a=testonly Automatic update from web-platform-tests [cookie-store] Deflake service worker registration (part 2) This is a follow-up to web-platform-tests/wpt#18324 This change by itself isn't sufficient to deflake the two tests. -- [cookie-store] Attempt to deflake two tests Move the event handler registration to the top scope of the service worker (Chrome warning: "Event handler of ... event must be added on the initial evaluation of worker script."). -- wpt-commits: a13797b678be16d1bec8cae0a8288e6101569cae, 909a1049b9431ae7e1a64c871b5c6822f0a90367 wpt-pr: 18340 UltraBlame original commit: e2ca31539fd1be204f9d095fa98d77521b82329a
Instead of attempting to unregister previously installed service workers
at the beginning of a test, use
add_completion_callback
to unregisterthem at test completion. This will deflake the tests when they are run
multiple times without restarts (
--rerun
).The alternative is to do what many tests in service-workers do:
unregister service workers at the start, but wait for newly installed
service workers to become activated and use
registration.active
instead of
registration.installing
, which is a bit more complex.Fixes the flakiness observed in #17866 .