-
Notifications
You must be signed in to change notification settings - Fork 122
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
Bug 1673672 - User RLB types for core metrics and add more tests #1432
Conversation
This makes porting tests from other bindings much more straightforward. Moreover, it paves the way to use glean_parser for generating the internal metrics as well.
This adds more tests ported over from the Kotlin language bindings (GleanTests.kt) to the RLB, specifically the ones testing the behavior around flipping the upload state.
52ee730
to
f90468d
Compare
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.
Looks good to me!
}), | ||
} | ||
} | ||
#[allow(non_upper_case_globals)] |
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.
You could move this to the top of the file as:
#![allow(non_upper_case_globals)]
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.
Oh right. If it doesn't bother you too much, I'd save another change and do that as a follow-up: we're going to re-generate this file anyway!
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.
Sure
@@ -28,6 +29,11 @@ impl StringMetric { | |||
pub fn new(meta: glean_core::CommonMetricData) -> Self { | |||
Self(Arc::new(glean_core::metrics::StringMetric::new(meta))) | |||
} | |||
|
|||
/// Internal only, synchronous API for setting a string value. | |||
pub(crate) fn set_sync<S: Into<std::string::String>>(&self, glean: &Glean, value: S) { |
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.
Yey for internal-only APIs and the compiler ensuring it stays that way
fn flipping_upload_enabled_respects_order_of_events() { | ||
todo!() | ||
// NOTES(janerik): |
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 make the best notes.
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.
You sure do ;-)
Oh, this will need a rebase because of the changelog changes. You can resolve that on GitHub using the UI if you want. |
RLB was using glean-core types instead of the new RLB types, which made writing tests a bit more complicated. This PR uses the binding types for the core metrics (as we do for the other bindings) and then ports back some tests from the Kotling bindings.
Note that using the RLB types also pave the way for using generated metrics :-)