Skip to content
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

[Resource Timing] Fix buffer-full-add-after-full-event test flakiness #16228

Merged
merged 1 commit into from Apr 16, 2019
Merged

[Resource Timing] Fix buffer-full-add-after-full-event test flakiness #16228

merged 1 commit into from Apr 16, 2019

Conversation

hawkinsw
Copy link
Contributor

@hawkinsw hawkinsw commented Apr 2, 2019

Resolve #15849 by offering up to five opportunities to
recognize that a new resource has been added to the page
after the buffer full event. This does not change
the semantics of the test but does make it more robust
in the face of timing variability.

} else {
reject("After buffer full (and " + tries +
" task ticks), entry never added to primary");
}
}
}
step_timeout(waitForIt, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the only place in those tests where we wait for the next task, which may not be a good enough guaranty.

It might be better to rename waitForNextTask to something like waitTillConditionIsMet, pass it a function that returns a boolean, and move the step_timeout calls and retries there. Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do think that this makes sense -- thank you for the suggestion! Just to make sure that I understood your suggestion completely, here is how I imagine the use of that function:

await waitUntilConditionIsMet(() => {
            if (performance.getEntriesByType("resource").length) {
                return true;
            } else {
                if (tries < maxTries) {
                    tries++;
                    return false;
                } else {
                    return true;
                }
            }
        }).then( (resolve, reject) => {
                if (performance.getEntriesByType("resource").length) {
                    resolve();
                } else {
                    reject();
                }
        });

Semantically, UntilConditionIsMet will not resolve until function in the parameter returns true.

I actually like the way that looks.

NB: That was written in a web comment field so it may not be syntactically correct :-)

Resolve #15849 by offering up to five opportunities to
recognize that a new resource has been added to the page
after the buffer full event. This does not change
the semantics of the test but does make it more robust
in the face of timing variability.
@hawkinsw
Copy link
Contributor Author

hawkinsw commented Apr 3, 2019

@yoavweiss Let me know what you think about this attempt. Once you think that it's a good approach, we can move through the other tests and do similar replacements!

Copy link
Contributor

@yoavweiss yoavweiss left a comment

Choose a reason for hiding this comment

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

LGTM! Apologies for the delay in reviewing...

@yoavweiss yoavweiss merged commit 636761d into web-platform-tests:master Apr 16, 2019
marcoscaceres pushed a commit that referenced this pull request Jul 23, 2019
…#16228)

Resolve #15849 by offering up to five opportunities to
recognize that a new resource has been added to the page
after the buffer full event. This does not change
the semantics of the test but does make it more robust
in the face of timing variability.
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.

Use eventFired in buffer-full-add-after-full-event test to avoid flakiness
4 participants