Skip to content

Commit

Permalink
Merge #1727
Browse files Browse the repository at this point in the history
1727: test(wipe): allow wipes on snapshots r=tiagolobocastro a=tiagolobocastro

This is actually not the correct behaviour, but previously e2e was dependent on this.
Until the API is modified to handle this properly, revert to the previous behaviour to ensure tests are running.

Co-authored-by: Tiago Castro <[email protected]>
  • Loading branch information
mayastor-bors and tiagolobocastro committed Aug 29, 2024
2 parents 81ac960 + 26cd220 commit c661e1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion io-engine/src/grpc/v1/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ impl TestRpc for TestService {
),
None => None,
};
let args = FindReplicaArgs::new(&args.uuid);
let repl = GrpcReplicaFactory::finder(
&FindReplicaArgs::new(&args.uuid),
// until API is modified to allow snapshots
&args.allow_snapshots(),
)
.await?;
validate_pool(&repl, pool).await?;
Expand Down
12 changes: 11 additions & 1 deletion io-engine/src/replica_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,22 @@ impl ListReplicaArgs {
pub struct FindReplicaArgs {
/// The replica uuid to find for.
pub uuid: String,
/// Finds Replicas which may also be snapshots.
pub allow_snapshots: bool,
}
impl FindReplicaArgs {
/// Create `Self` with the replica uuid.
pub fn new(uuid: &str) -> Self {
Self {
uuid: uuid.to_string(),
allow_snapshots: false,
}
}
/// Allow finding replicas which may also be snapshots.
pub fn allow_snapshots(self) -> Self {
Self {
allow_snapshots: true,
..self
}
}
}
Expand Down Expand Up @@ -290,7 +300,7 @@ impl ReplicaFactory {
match factory.0.find(args).await {
Ok(Some(replica)) => {
// should this be an error?
if !replica.is_snapshot() {
if !replica.is_snapshot() || args.allow_snapshots {
return Ok(replica);
}
}
Expand Down

0 comments on commit c661e1b

Please sign in to comment.