-
Notifications
You must be signed in to change notification settings - Fork 47
add repository field for stacks, clean up clippy wanrings #517
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 1 commit
7ffef5e
f056b3f
7412b2d
4728615
5953314
cbf1394
4d64912
443c835
9b7f0fd
3f1b833
0825b39
9d6d4f0
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 |
---|---|---|
|
@@ -405,7 +405,7 @@ async fn check_for_extensions_enabled_with_load( | |
for extension in trunk_installed_extensions_not_in_all_actually_installed_extensions.clone() | ||
{ | ||
let found = | ||
check_for_so_files(cdb, ctx.clone(), &*pod_name, extension.name.clone()).await?; | ||
check_for_so_files(cdb, ctx.clone(), &pod_name, extension.name.clone()).await?; | ||
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. Fix clippy warning |
||
// If found, add to extensions_with_load | ||
if found { | ||
// Get trunk project description for extension | ||
|
@@ -430,7 +430,7 @@ async fn check_for_extensions_enabled_with_load( | |
found = true; | ||
for desired_location in desired_extension.locations { | ||
let location_status = ExtensionInstallLocationStatus { | ||
enabled: Some(desired_location.enabled.clone()), | ||
enabled: Some(desired_location.enabled), | ||
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. Fix clippy warning |
||
database: desired_location.database.clone(), | ||
schema: desired_location.schema.clone(), | ||
version: desired_location.version.clone(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,7 +277,7 @@ pub async fn get_trunk_project_metadata_for_version( | |
let response_body = response.text().await?; | ||
let project_metadata: Vec<TrunkProjectMetadata> = serde_json::from_str(&response_body)?; | ||
// There will only be one index here, so we can safely assume index 0 | ||
let project_metadata = match project_metadata.get(0) { | ||
let project_metadata = match project_metadata.first() { | ||
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. Fix clippy warning |
||
Some(project_metadata) => project_metadata, | ||
None => { | ||
error!( | ||
|
@@ -367,7 +367,7 @@ pub async fn is_control_file_absent( | |
// where there are multiple extensions | ||
let control_file_absent = project_metadata | ||
.extensions | ||
.get(0) | ||
.first() | ||
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. Fix clippy warning |
||
.unwrap() | ||
.control_file | ||
.absent; | ||
|
@@ -411,18 +411,11 @@ pub async fn get_loadable_library_name( | |
} | ||
}; | ||
// Find the loadable library in the extension metadata | ||
let loadable_library_name = match extension_metadata.loadable_libraries { | ||
Some(ref loadable_libraries) => { | ||
let loadable_library = loadable_libraries | ||
.iter() | ||
.find(|l| l.requires_restart == true); | ||
match loadable_library { | ||
Some(loadable_library) => Some(loadable_library.library_name.clone()), | ||
None => None, | ||
} | ||
} | ||
None => None, | ||
}; | ||
let loadable_library_name = extension_metadata | ||
.loadable_libraries | ||
.as_ref() | ||
.and_then(|loadable_libraries| loadable_libraries.iter().find(|l| l.requires_restart)) | ||
.map(|loadable_library| loadable_library.library_name.clone()); | ||
Comment on lines
+414
to
+418
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. Fix clippy warning |
||
Ok(loadable_library_name) | ||
} | ||
|
||
|
@@ -496,8 +489,8 @@ pub fn convert_to_semver(version: String) -> String { | |
fn sort_semver(versions: Vec<String>) -> Vec<String> { | ||
let mut versions = versions; | ||
versions.sort_by(|a, b| { | ||
let a = semver::Version::parse(&a).unwrap(); | ||
let b = semver::Version::parse(&b).unwrap(); | ||
let a = semver::Version::parse(a).unwrap(); | ||
let b = semver::Version::parse(b).unwrap(); | ||
Comment on lines
+492
to
+493
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. Fix clippy warning |
||
a.cmp(&b) | ||
}); | ||
versions | ||
|
@@ -550,17 +543,17 @@ mod tests { | |
let extension_name = "auto_explain".to_string(); | ||
let result = extension_name_matches_trunk_project(extension_name).await; | ||
assert!(result.is_ok()); | ||
assert_eq!(result.unwrap(), true); | ||
assert!(result.unwrap()); | ||
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. Fix clippy warning |
||
|
||
let extension_name = "pgml".to_string(); | ||
let result = extension_name_matches_trunk_project(extension_name).await; | ||
assert!(result.is_ok()); | ||
assert_eq!(result.unwrap(), false); | ||
assert!(!result.unwrap()); | ||
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. Fix clippy warning |
||
|
||
let extension_name = "vector".to_string(); | ||
let result = extension_name_matches_trunk_project(extension_name).await; | ||
assert!(result.is_ok()); | ||
assert_eq!(result.unwrap(), false); | ||
assert!(!result.unwrap()); | ||
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. Fix clippy warning |
||
} | ||
|
||
#[tokio::test] | ||
|
@@ -592,7 +585,7 @@ mod tests { | |
let version = "15.3.0".to_string(); | ||
let result = is_control_file_absent(trunk_project, version).await; | ||
assert!(result.is_ok()); | ||
assert_eq!(result.unwrap(), true); | ||
assert!(result.unwrap()); | ||
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. Fix clippy warning |
||
} | ||
|
||
#[tokio::test] | ||
|
@@ -618,11 +611,11 @@ mod tests { | |
fn test_is_semver() { | ||
let version = "1.2.3".to_string(); | ||
let result = is_semver(version); | ||
assert_eq!(result, true); | ||
assert!(result); | ||
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. Fix clippy warning |
||
|
||
let version = "1.2".to_string(); | ||
let result = is_semver(version); | ||
assert_eq!(result, false); | ||
assert!(!result); | ||
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. Fix clippy warning |
||
} | ||
|
||
#[test] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,6 @@ mod test { | |
}; | ||
use rand::Rng; | ||
use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; | ||
use std::thread::sleep; | ||
use std::{ | ||
collections::{BTreeMap, BTreeSet}, | ||
ops::Not, | ||
|
@@ -613,19 +612,17 @@ mod test { | |
attempt, max_retries, name, extension | ||
); | ||
} | ||
} else if has_extension { | ||
println!( | ||
"CoreDB {} has extension {} enabled in status", | ||
name, extension | ||
); | ||
return Ok(()); | ||
Comment on lines
+615
to
+620
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. Fix clippy warning |
||
} else { | ||
if has_extension { | ||
println!( | ||
"CoreDB {} has extension {} enabled in status", | ||
name, extension | ||
); | ||
return Ok(()); | ||
} else { | ||
println!( | ||
"Attempt {}/{}: CoreDB {} has extension {} disabled in status", | ||
attempt, max_retries, name, extension | ||
); | ||
} | ||
println!( | ||
"Attempt {}/{}: CoreDB {} has extension {} disabled in status", | ||
attempt, max_retries, name, extension | ||
); | ||
} | ||
} | ||
Err(e) => { | ||
|
@@ -2332,7 +2329,7 @@ mod test { | |
}); | ||
let params = PatchParams::apply("tembo-integration-test"); | ||
let patch = Patch::Apply(&coredb_json); | ||
let coredb_resource = coredbs.patch(name, ¶ms, &patch).await.unwrap(); | ||
let _coredb_resource = coredbs.patch(name, ¶ms, &patch).await.unwrap(); | ||
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. Fix clippy warning |
||
|
||
// Wait for CNPG Pod to be created | ||
let pods: Api<Pod> = Api::namespaced(client.clone(), &namespace); | ||
|
@@ -2346,7 +2343,7 @@ mod test { | |
// Check status.extensions.locations is not empty | ||
let coredb_resource = coredbs.get(name).await.unwrap(); | ||
for extension in coredb_resource.status.unwrap().extensions.unwrap() { | ||
assert!(extension.locations.len() > 0); | ||
assert!(!extension.locations.is_empty()); | ||
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. Fix clippy warning |
||
} | ||
|
||
// Update CoreDB resource to enable extensions | ||
|
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.
Is it possible for the values in this file to come from the stack yamls? So it's like if someone updates the image in a stack yaml, then the operator tests run in CI and it's using the new image from the stack yaml for which there are operator tests?
If we don't do that, then our operator tests use the image configured here in the defaults, but a future change to stack yaml, then following that to update in control plane, can result in us use image defaults that have not been tested by the functional testing in the operator code