-
Notifications
You must be signed in to change notification settings - Fork 123
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 1679793: Change the RLB Configuration to use PathBuf for the data… #1493
Conversation
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.
This looks mostly good. Some simplications are possible, I think I annotated all (you can batch them up here on GitHub and commit that as one thing right from the UI).
I rekicked the tests, I'm not sure why they failed. That's definitely unrelated. If they fail again I need to take another look before we can land this.
glean-core/rlb/examples/prototype.rs
Outdated
} else { | ||
let root = Builder::new().prefix("simple-db").tempdir().unwrap(); | ||
root.path().display().to_string() | ||
PathBuf::from(root.path().display().to_string()) |
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.
PathBuf::from(root.path().display().to_string()) | |
root.path().to_path_buf() |
glean-core/rlb/src/common_test.rs
Outdated
@@ -36,7 +37,7 @@ pub(crate) fn new_glean( | |||
clear_stores: bool, | |||
) -> tempfile::TempDir { | |||
let dir = tempfile::tempdir().unwrap(); | |||
let tmpname = dir.path().display().to_string(); | |||
let tmpname = PathBuf::from(dir.path().display().to_string()); |
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.
let tmpname = PathBuf::from(dir.path().display().to_string()); | |
let tmpname = dir.path().to_path_buf(); |
glean-core/rlb/src/test.rs
Outdated
@@ -35,7 +35,7 @@ fn send_a_ping() { | |||
|
|||
// Create a custom configuration to use a fake uploader. | |||
let dir = tempfile::tempdir().unwrap(); | |||
let tmpname = dir.path().display().to_string(); | |||
let tmpname = PathBuf::from(dir.path().display().to_string()); |
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.
let tmpname = PathBuf::from(dir.path().display().to_string()); | |
let tmpname = dir.path().to_path_buf(); |
glean-core/rlb/src/test.rs
Outdated
@@ -144,7 +144,7 @@ fn test_experiments_recording_before_glean_inits() { | |||
set_experiment_inactive("experiment_preinit_disabled".to_string()); | |||
|
|||
let dir = tempfile::tempdir().unwrap(); | |||
let tmpname = dir.path().display().to_string(); | |||
let tmpname = PathBuf::from(dir.path().display().to_string()); |
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.
let tmpname = PathBuf::from(dir.path().display().to_string()); | |
let tmpname = dir.path().to_path_buf(); |
glean-core/rlb/src/test.rs
Outdated
@@ -205,7 +205,7 @@ fn sending_of_foreground_background_pings() { | |||
|
|||
// Create a custom configuration to use a fake uploader. | |||
let dir = tempfile::tempdir().unwrap(); | |||
let tmpname = dir.path().display().to_string(); | |||
let tmpname = PathBuf::from(dir.path().display().to_string()); |
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.
let tmpname = PathBuf::from(dir.path().display().to_string()); | |
let tmpname = dir.path().to_path_buf(); |
glean-core/rlb/tests/schema.rs
Outdated
@@ -22,7 +23,7 @@ const GLOBAL_APPLICATION_ID: &str = "org.mozilla.glean.test.app"; | |||
// We need to keep the `TempDir` alive, so that it's not deleted before we stop using it. | |||
fn new_glean(configuration: Option<Configuration>) -> tempfile::TempDir { | |||
let dir = tempfile::tempdir().unwrap(); | |||
let tmpname = dir.path().display().to_string(); | |||
let tmpname = PathBuf::from(dir.path().display().to_string()); |
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.
let tmpname = PathBuf::from(dir.path().display().to_string()); | |
let tmpname = dir.path().to_path_buf(); |
glean-core/rlb/tests/schema.rs
Outdated
@@ -74,7 +75,7 @@ fn validate_against_schema() { | |||
|
|||
// Create a custom configuration to use a validating uploader. | |||
let dir = tempfile::tempdir().unwrap(); | |||
let tmpname = dir.path().display().to_string(); | |||
let tmpname = PathBuf::from(dir.path().display().to_string()); |
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.
let tmpname = PathBuf::from(dir.path().display().to_string()); | |
let tmpname = dir.path().to_path_buf(); |
glean-core/rlb/tests/schema.rs
Outdated
@@ -3,6 +3,7 @@ | |||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | |||
|
|||
use std::io::Read; | |||
use std::path::PathBuf; |
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.
use std::path::PathBuf; |
glean-core/rlb/tests/simple.rs
Outdated
@@ -11,6 +11,7 @@ | |||
mod common; | |||
|
|||
use glean::Configuration; | |||
use std::path::PathBuf; |
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.
use std::path::PathBuf; |
glean-core/rlb/tests/simple.rs
Outdated
@@ -57,7 +58,7 @@ fn simple_lifecycle() { | |||
|
|||
// Create a custom configuration to use a validating uploader. | |||
let dir = tempfile::tempdir().unwrap(); | |||
let tmpname = dir.path().display().to_string(); | |||
let tmpname = PathBuf::from(dir.path().display().to_string()); |
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.
let tmpname = PathBuf::from(dir.path().display().to_string()); | |
let tmpname = dir.path().to_path_buf(); |
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.
Thank you for pointing that out (how come I didn't notice the to_path_buf()
method?).
The requested changes had been made.
f589155
to
8f1ad2a
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.
👍 -- One last thing, sorry I forgot to mention it in the first review, this is a breaking change due to the type change.
Can you add an entry to the Changelog?
Something like
* RLB
* **Breaking change:** Configuration now expects data path as a `PathBuf` ([#1493](https://github.com/mozilla/glean/pull/1493)).
8f1ad2a
to
6d55a91
Compare
Use
std::path::PathBuf
instead ofString
forglean::configueation::Configuration.data_path
. Several test cases had also been modified to reflect the change.All commands succeeded:
@badboy Please review and let me know in case any change is needed. Thank you!