Skip to content

Commit c661e1b

Browse files
mayastor-borstiagolobocastro
mayastor-bors
andcommitted
Merge #1727
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 <tiagolobocastro@gmail.com>
2 parents 81ac960 + 26cd220 commit c661e1b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

io-engine/src/grpc/v1/test.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ impl TestRpc for TestService {
111111
),
112112
None => None,
113113
};
114+
let args = FindReplicaArgs::new(&args.uuid);
114115
let repl = GrpcReplicaFactory::finder(
115-
&FindReplicaArgs::new(&args.uuid),
116+
// until API is modified to allow snapshots
117+
&args.allow_snapshots(),
116118
)
117119
.await?;
118120
validate_pool(&repl, pool).await?;

io-engine/src/replica_backend.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,22 @@ impl ListReplicaArgs {
153153
pub struct FindReplicaArgs {
154154
/// The replica uuid to find for.
155155
pub uuid: String,
156+
/// Finds Replicas which may also be snapshots.
157+
pub allow_snapshots: bool,
156158
}
157159
impl FindReplicaArgs {
158160
/// Create `Self` with the replica uuid.
159161
pub fn new(uuid: &str) -> Self {
160162
Self {
161163
uuid: uuid.to_string(),
164+
allow_snapshots: false,
165+
}
166+
}
167+
/// Allow finding replicas which may also be snapshots.
168+
pub fn allow_snapshots(self) -> Self {
169+
Self {
170+
allow_snapshots: true,
171+
..self
162172
}
163173
}
164174
}
@@ -290,7 +300,7 @@ impl ReplicaFactory {
290300
match factory.0.find(args).await {
291301
Ok(Some(replica)) => {
292302
// should this be an error?
293-
if !replica.is_snapshot() {
303+
if !replica.is_snapshot() || args.allow_snapshots {
294304
return Ok(replica);
295305
}
296306
}

0 commit comments

Comments
 (0)