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

Bug 1673672 - User RLB types for core metrics and add more tests #1432

Merged
merged 4 commits into from
Jan 15, 2021

Conversation

Dexterp37
Copy link
Contributor

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 :-)

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.
@Dexterp37 Dexterp37 requested a review from badboy January 14, 2021 16:11
@Dexterp37 Dexterp37 self-assigned this Jan 14, 2021
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.
Copy link
Member

@badboy badboy left a 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)]
Copy link
Member

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)]

Copy link
Contributor Author

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!

Copy link
Member

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) {
Copy link
Member

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):
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You sure do ;-)

@badboy
Copy link
Member

badboy commented Jan 15, 2021

Oh, this will need a rebase because of the changelog changes. You can resolve that on GitHub using the UI if you want.

@Dexterp37 Dexterp37 merged commit de90afe into mozilla:main Jan 15, 2021
@Dexterp37 Dexterp37 deleted the rlb_more_tests branch January 15, 2021 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants