mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-06-18 02:24:27 +02:00
address compiler error review comments
This commit is contained in:
parent
4590c91f9d
commit
f118b67402
3 changed files with 39 additions and 4 deletions
|
|
@ -340,9 +340,9 @@ impl ClusterStore {
|
|||
uris.retain(|uri| uri.ends_with(".json"));
|
||||
uris.sort();
|
||||
uris.into_iter()
|
||||
.map(|uri| match uri.rsplit('/').next() {
|
||||
Some(name) => format!("{}/{name}", self.display(CLUSTER_RECOVERIES_DIR)),
|
||||
None => uri,
|
||||
.map(|uri| {
|
||||
let name = uri.rsplit_once('/').map_or(uri.as_str(), |(_, name)| name);
|
||||
format!("{}/{name}", self.display(CLUSTER_RECOVERIES_DIR))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3375,6 +3375,35 @@ policies:
|
|||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn read_only_commands_ignore_missing_recovery_sidecar_dir() {
|
||||
let dir = fixture();
|
||||
write_applyable_state(dir.path());
|
||||
assert!(!dir.path().join(CLUSTER_RECOVERIES_DIR).exists());
|
||||
|
||||
let status = status_config_dir(dir.path()).await;
|
||||
assert!(status.ok, "{:?}", status.diagnostics);
|
||||
assert!(
|
||||
!status.diagnostics.iter().any(|diagnostic| matches!(
|
||||
diagnostic.code.as_str(),
|
||||
"recovery_sidecar_read_error" | "cluster_recovery_pending"
|
||||
)),
|
||||
"{:?}",
|
||||
status.diagnostics
|
||||
);
|
||||
|
||||
let plan = plan_config_dir(dir.path()).await;
|
||||
assert!(plan.ok, "{:?}", plan.diagnostics);
|
||||
assert!(
|
||||
!plan.diagnostics.iter().any(|diagnostic| matches!(
|
||||
diagnostic.code.as_str(),
|
||||
"recovery_sidecar_read_error" | "cluster_recovery_pending"
|
||||
)),
|
||||
"{:?}",
|
||||
plan.diagnostics
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn read_only_commands_warn_on_pending_recovery_sidecar_in_storage_root() {
|
||||
let dir = fixture();
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ mod tests {
|
|||
let allowed_file = workspace_root.join("crates/omnigraph-compiler/src/error.rs");
|
||||
let mut offenders = Vec::new();
|
||||
|
||||
visit_rs_files(&workspace_root.join("crates"), &mut |path| {
|
||||
visit_rs_files(workspace_root, &mut |path| {
|
||||
let text = std::fs::read_to_string(path).expect("source file should be readable");
|
||||
let count = text.matches(&legacy_name).count();
|
||||
if path == allowed_file {
|
||||
|
|
@ -202,6 +202,12 @@ mod tests {
|
|||
let entry = entry.expect("source entry should be readable");
|
||||
let path = entry.path();
|
||||
if path.is_dir() {
|
||||
if matches!(
|
||||
path.file_name().and_then(|name| name.to_str()),
|
||||
Some(".git" | "target")
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
visit_rs_files(&path, visit);
|
||||
} else if path.extension().and_then(|ext| ext.to_str()) == Some("rs") {
|
||||
visit(&path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue