read and write working
This commit is contained in:
parent
b3498b8e1e
commit
87c04454ad
@ -84,7 +84,7 @@ struct FileManager {
|
||||
|
||||
impl FileManager {
|
||||
async fn init(path: &str) -> std::io::Result<Self> {
|
||||
let file = File::open(path).await?;
|
||||
let file = File::options().read(true).append(true).open(path).await?;
|
||||
Ok(Self {
|
||||
file: Mutex::new(file),
|
||||
})
|
||||
@ -196,8 +196,14 @@ mod tests {
|
||||
node.keypair.to_keypair_bytes(),
|
||||
retrieved_node.keypair.to_keypair_bytes()
|
||||
);
|
||||
assert_eq!(node.joined_at, retrieved_node.joined_at);
|
||||
|
||||
assert_eq!(
|
||||
node.joined_at.duration_since(UNIX_EPOCH).unwrap().as_secs(),
|
||||
retrieved_node
|
||||
.joined_at
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs()
|
||||
);
|
||||
remove_file(get_test_file_name(function_name)).await?;
|
||||
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user