Skip to content

Commit 6cdf669

Browse files
committed
fix test
1 parent c1e5828 commit 6cdf669

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

crates/nfs3_tests/tests/base_tests.rs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,23 +306,45 @@ async fn test_create_exclusive() -> Result<(), anyhow::Error> {
306306
let mut client = TestContext::setup();
307307
let root = client.root_dir().clone();
308308

309+
let _create = client
310+
.create(CREATE3args {
311+
where_: diropargs3 {
312+
dir: root.clone(),
313+
name: b"new_file.txt".as_slice().into(),
314+
},
315+
how: createhow3::EXCLUSIVE(createverf3(1234u64.to_ne_bytes())),
316+
})
317+
.await?
318+
.unwrap();
319+
309320
let create = client
310321
.create(CREATE3args {
311322
where_: diropargs3 {
312323
dir: root.clone(),
313324
name: b"new_file.txt".as_slice().into(),
314325
},
315-
how: createhow3::EXCLUSIVE(createverf3([0u8; 8])),
326+
how: createhow3::EXCLUSIVE(createverf3(5678u64.to_ne_bytes())),
316327
})
317328
.await?;
318329

319-
tracing::info!("{create:?}");
320-
if matches!(&create, Nfs3Result::Err((nfsstat3::NFS3ERR_NOTSUPP, _))) {
321-
tracing::info!("not supported by current implementation");
330+
if matches!(create, Nfs3Result::Err((nfsstat3::NFS3ERR_EXIST, _))) {
331+
tracing::info!("file already exists, as expected");
322332
} else {
323-
panic!("Expected NFS3ERR_NOTSUPP error");
333+
panic!("Expected NFS3ERR_EXIST error");
324334
}
325335

336+
// recreate the file with the same verifier, should succeed
337+
let _create = client
338+
.create(CREATE3args {
339+
where_: diropargs3 {
340+
dir: root.clone(),
341+
name: b"new_file.txt".as_slice().into(),
342+
},
343+
how: createhow3::EXCLUSIVE(createverf3(1234u64.to_ne_bytes())),
344+
})
345+
.await?
346+
.unwrap();
347+
326348
client.shutdown().await
327349
}
328350

0 commit comments

Comments
 (0)