-
Notifications
You must be signed in to change notification settings - Fork 34
Bug 1701889 - Implement the ping testing api #202
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
ac5f717 to
eac5ffc
Compare
brizental
left a comment
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.
I am ok with the overall approach. I don't see any other way to implement this feature either. I'll move Bug 1682771 to P2 though. Disallowing test APIs outside of tests seems even more important with this feature.
2ae611a to
199583e
Compare
brizental
left a comment
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.
Will continue on the tests I was doing yesterday, my concerns still remain. I explained what are these concerns on the comment I left on the tests code.
|
Ad discussed with @brizental , sadly we have no way to guarantee that metric calls executed after Sadly, that's a bigger change. I'm closing this PR. |
|
Let's give this another opportunity. |
35ffbde to
1a7ce5e
Compare
This commit adds testBeforeNextSubmit to execute a validation function synchronously before the target ping is collected.
... of this implementation
1a7ce5e to
991d3fc
Compare
glean/src/core/pings/ping_type.ts
Outdated
| // This guarantees that, when running tests, the promise returned by | ||
| // `testBeforeNextSubmit` is resolved after the ping is collected: this is | ||
| // needed to make sure calling the testing APIs on metrics behave consistently | ||
| // if tests run fast. |
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.
Again, I think this comment is a bit confusing and the code speaks for itself.
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.
Still think this comment is not necessary... But also wrong now? Specifically
// [...] this is
// needed to make sure calling the testing APIs on metrics behave consistently
// if tests run fast.
17e4992 to
15a6526
Compare
brizental
left a comment
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.
r+wc
glean/src/core/pings/ping_type.ts
Outdated
| // This guarantees that, when running tests, the promise returned by | ||
| // `testBeforeNextSubmit` is resolved after the ping is collected: this is | ||
| // needed to make sure calling the testing APIs on metrics behave consistently | ||
| // if tests run fast. |
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.
Still think this comment is not necessary... But also wrong now? Specifically
// [...] this is
// needed to make sure calling the testing APIs on metrics behave consistently
// if tests run fast.
glean/src/core/pings/ping_type.ts
Outdated
| * TODO: Only allow this function to be called on test mode (depends on Bug 1682771). | ||
| * | ||
| * @param callbackFn The asynchronous validation function to run in order to validate | ||
| * the ping content. |
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.
nit: Align the second line with callbackFn.
| sendIfEmpty: false, | ||
| }); | ||
| await submitSync(ping); | ||
| const storedPings = await Context.pingsDatabase["store"]._getWholeStore(); |
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.
nit: can you rename this file to ping_type.spec.ts since we are here?
15a6526 to
31051c4
Compare
This implements the pings testing API, as discussed and designed in the related bug.