-
Notifications
You must be signed in to change notification settings - Fork 645
Prep for semver bump and document current blocker #3338
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,71 @@ | ||||||||||||
use crate::{ | ||||||||||||
db, | ||||||||||||
schema::{dependencies, versions}, | ||||||||||||
}; | ||||||||||||
|
||||||||||||
use clap::Clap; | ||||||||||||
use diesel::prelude::*; | ||||||||||||
|
||||||||||||
#[derive(Clap, Copy, Clone, Debug)] | ||||||||||||
#[clap( | ||||||||||||
name = "test-new-semver-release", | ||||||||||||
about = "Scan the database for all versions and version requirements to \ | ||||||||||||
ensure they can be parsed by the latest `semver` crate." | ||||||||||||
)] | ||||||||||||
pub struct Opts {} | ||||||||||||
|
||||||||||||
pub fn run(_opts: Opts) { | ||||||||||||
use self::dependencies::dsl::*; | ||||||||||||
use self::versions::dsl::*; | ||||||||||||
|
||||||||||||
let url = db::connection_url(&dotenv::var("READ_ONLY_REPLICA_URL").unwrap()); | ||||||||||||
let conn = PgConnection::establish(&url).unwrap(); | ||||||||||||
conn.transaction::<_, diesel::result::Error, _>(|| { | ||||||||||||
let vers = versions.select(num).load(&conn)?; | ||||||||||||
test_versions(&vers); | ||||||||||||
|
||||||||||||
let deps = dependencies.select(req).load(&conn)?; | ||||||||||||
test_dependency_predicates(&deps); | ||||||||||||
|
||||||||||||
Ok(()) | ||||||||||||
}) | ||||||||||||
.unwrap(); | ||||||||||||
|
||||||||||||
println!("Test finished."); | ||||||||||||
} | ||||||||||||
|
||||||||||||
fn test_versions(versions: &[String]) { | ||||||||||||
for version in versions { | ||||||||||||
if let Err(e) = semver::Version::parse(version) { | ||||||||||||
println!("Could not parse `{}` as a semver::Version: {}", version, e); | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
Comment on lines
+38
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
this looks like a duplicate to me, no? |
||||||||||||
for version in versions { | ||||||||||||
if let Err(e) = semver::Version::parse(version) { | ||||||||||||
println!("Could not parse `{}` as a semver::Version: {}", version, e); | ||||||||||||
} | ||||||||||||
|
||||||||||||
if let Err(e) = semver_next::Version::parse(version) { | ||||||||||||
println!( | ||||||||||||
"Could not parse `{}` as a semver_next::Version: {}", | ||||||||||||
version, e | ||||||||||||
); | ||||||||||||
} | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
fn test_dependency_predicates(versions: &[String]) { | ||||||||||||
for version in versions { | ||||||||||||
if let Err(e) = semver::VersionReq::parse(version) { | ||||||||||||
println!("Could not parse `{}` as a semver::Version: {}", version, e); | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
} | ||||||||||||
|
||||||||||||
if let Err(e) = semver_next::VersionReq::parse(version) { | ||||||||||||
println!( | ||||||||||||
"Could not parse `{}` as a semver_next::Version: {}", | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
version, e | ||||||||||||
); | ||||||||||||
} | ||||||||||||
} | ||||||||||||
} |
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'm not entirely sure about loading all dependencies in a single query, but this is against the replica database and I expect memory usage to be somewhere around 100 MB so I think this is okay for our current scale.