mirror of
https://github.com/qwjyh/xdbm
synced 2025-04-18 18:55:51 +09:00
update(test): use sync command
The first sync from 2nd device didn't work, maybe due to that it is the first push.
This commit is contained in:
parent
9bf534df1d
commit
99714b4b29
1 changed files with 17 additions and 30 deletions
47
tests/cli.rs
47
tests/cli.rs
|
@ -2,6 +2,7 @@ mod integrated_test {
|
|||
use std::{
|
||||
fs::{self, DirBuilder, File},
|
||||
io::{self, BufWriter, Write},
|
||||
path,
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, Context, Ok, Result};
|
||||
|
@ -72,6 +73,16 @@ mod integrated_test {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn run_sync_cmd(config_dir: &path::Path) -> Result<()> {
|
||||
Command::cargo_bin("xdbm")?
|
||||
.arg("-c")
|
||||
.arg(config_dir)
|
||||
.args(["sync", "-vvvv"])
|
||||
.assert()
|
||||
.success();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_device() -> Result<()> {
|
||||
let config_dir = assert_fs::TempDir::new()?;
|
||||
|
@ -380,16 +391,8 @@ mod integrated_test {
|
|||
std::fs::read_to_string(config_dir_1.join("storages.yml"))?.contains("parent: gdrive1")
|
||||
);
|
||||
|
||||
std::process::Command::new("git")
|
||||
.arg("push")
|
||||
.current_dir(&config_dir_1)
|
||||
.assert()
|
||||
.success();
|
||||
std::process::Command::new("git")
|
||||
.arg("pull")
|
||||
.current_dir(&config_dir_2)
|
||||
.assert()
|
||||
.success();
|
||||
run_sync_cmd(&config_dir_1)?;
|
||||
run_sync_cmd(&config_dir_2)?;
|
||||
|
||||
// bind
|
||||
//
|
||||
|
@ -603,16 +606,8 @@ mod integrated_test {
|
|||
.and(predicate::str::contains("foodoc").not()),
|
||||
);
|
||||
|
||||
std::process::Command::new("git")
|
||||
.arg("push")
|
||||
.current_dir(&config_dir_2)
|
||||
.assert()
|
||||
.success();
|
||||
std::process::Command::new("git")
|
||||
.arg("pull")
|
||||
.current_dir(&config_dir_1)
|
||||
.assert()
|
||||
.success();
|
||||
run_sync_cmd(&config_dir_2)?;
|
||||
run_sync_cmd(&config_dir_1)?;
|
||||
|
||||
// bind
|
||||
//
|
||||
|
@ -727,16 +722,8 @@ mod integrated_test {
|
|||
.assert()
|
||||
.success();
|
||||
|
||||
std::process::Command::new("git")
|
||||
.arg("push")
|
||||
.current_dir(&config_dir_1)
|
||||
.assert()
|
||||
.success();
|
||||
std::process::Command::new("git")
|
||||
.arg("pull")
|
||||
.current_dir(&config_dir_2)
|
||||
.assert()
|
||||
.success();
|
||||
run_sync_cmd(&config_dir_1)?;
|
||||
run_sync_cmd(&config_dir_2)?;
|
||||
|
||||
// backup add
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue