fix(tests): fix testsuite allow to pass push
This commit is contained in:
@@ -6,7 +6,7 @@ pub fn has_files(full_path: PathBuf, file: &str, content: &str, test_id: String)
|
||||
{
|
||||
if !full_path.exists() {
|
||||
println!("id: {}", test_id.clone());
|
||||
eprintln!("File '{}' doesn't exists on the server", file);
|
||||
eprintln!("File '{}' doesn't exists", file);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ impl ServerTest {
|
||||
}
|
||||
|
||||
pub fn init(&mut self) -> &mut ServerTest{
|
||||
self.add_dir(self.test_id.clone());
|
||||
self.add_dir(&self.test_id.clone());
|
||||
self.volume = self.volume.join(self.test_id.clone());
|
||||
self.sync_test();
|
||||
self.sync_root();
|
||||
self
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ impl ServerTest {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_dir(&mut self, path: String) -> &mut ServerTest {
|
||||
pub fn add_dir(&mut self, path: &str) -> &mut ServerTest {
|
||||
let mut full_path = self.volume.clone();
|
||||
full_path.push(path);
|
||||
|
||||
@@ -55,6 +55,11 @@ impl ServerTest {
|
||||
Err(e) => eprintln!("Error creating directory: {}", e),
|
||||
}
|
||||
|
||||
// do not sync test directory when creating it
|
||||
if !path.ends_with("_nextsync")
|
||||
{
|
||||
self.sync_test();
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
@@ -73,6 +78,7 @@ impl ServerTest {
|
||||
full_path.push(path);
|
||||
|
||||
let _ = fs::remove_dir_all(&full_path);
|
||||
self.sync_test();
|
||||
self
|
||||
}
|
||||
|
||||
@@ -89,17 +95,12 @@ impl ServerTest {
|
||||
// perform the occ files:scan command inside the nextcloud docker container
|
||||
|
||||
let nextcloud_docker = "master-nextcloud-1";
|
||||
let mut args = String::from("exec -ti --user www-data");
|
||||
args.push_str(nextcloud_docker);
|
||||
args.push_str("/var/www/html/occ files:scan --path=/");
|
||||
args.push_str(&self.user);
|
||||
args.push_str("files/");
|
||||
args.push_str(path);
|
||||
let args = format!("exec -t --user www-data {} /var/www/html/occ files:scan --path=/{}/files/{}", nextcloud_docker, &self.user, path);
|
||||
|
||||
let _output = Command::new("docker")
|
||||
.args(args.split(" "))
|
||||
.output()
|
||||
.expect("Could not execute nextsync command");
|
||||
.expect("Could not execute docker exec command");
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user