Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
beac0n committed Aug 15, 2024
1 parent 1357b7b commit 2cdb9a6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test_end_to_end: clean_test_end_to_end release

sudo mkdir /etc/ruroco
sudo mv ./ruroco_public.pem /etc/ruroco
sudo cp ./tests/config_end_to_end.toml /etc/ruroco/config.toml
sudo cp ./tests/files/config_end_to_end.toml /etc/ruroco/config.toml
sudo chmod 400 /etc/ruroco/ruroco_public.pem

sudo chown -R ruroco:ruroco /tmp/ruroco_test
Expand Down
8 changes: 6 additions & 2 deletions tests/commander_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod tests {
let path = env::current_dir()
.unwrap_or(PathBuf::from("/tmp"))
.join("tests")
.join("files")
.join("config_invalid.toml");

let result = Commander::create_from_path(path);
Expand Down Expand Up @@ -49,8 +50,11 @@ mod tests {
String::from("touch /tmp/ruroco_test/start.test /tmp/ruroco_test/stop.test"),
);

let path =
env::current_dir().unwrap_or(PathBuf::from("/tmp")).join("tests").join("config.toml");
let path = env::current_dir()
.unwrap_or(PathBuf::from("/tmp"))
.join("tests")
.join("files")
.join("config.toml");

assert_eq!(
Commander::create_from_path(path),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion tests/server_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod tests {
#[test]
fn test_create_from_path() {
let tests_dir_path = env::current_dir().unwrap_or(PathBuf::from("/tmp")).join("tests");
let conf_path = tests_dir_path.join("config.toml");
let conf_path = tests_dir_path.join("files").join("config.toml");
let conf_dir_path = tests_dir_path.join("conf_dir");

let res_path = Server::create_from_path(conf_path).unwrap();
Expand All @@ -43,6 +43,7 @@ mod tests {
let path = env::current_dir()
.unwrap_or(PathBuf::from("/tmp"))
.join("tests")
.join("files")
.join("config_invalid.toml");

let result = Server::create_from_path(path);
Expand Down

0 comments on commit 2cdb9a6

Please sign in to comment.