From 97426387ce06a3c9622a919fea0b3d7b04c68e72 Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Sat, 29 Apr 2023 20:26:25 +0200 Subject: Add required user config for tests into the tests --- readme.org | 10 +++++----- tests/server_shell.rs | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/readme.org b/readme.org index b7c9702..cbb61db 100644 --- a/readme.org +++ b/readme.org @@ -88,6 +88,10 @@ all of the options, and is a great way to learn what all the commands do. ** Installation +#+begin_src sh + cargo install --git https://code.worthe-it.co.za/shackle.git/ --root /opt/bin/shackle --force +#+end_src + # TODO # - cargo install to build from source @@ -145,12 +149,8 @@ environment ready. # Docker sudo usermod -a -G docker $USER sudo systemctl start docker.service - # Note: you need to log out and in again for the new group to take effect - # TODO: The tests themselves should set these, scoped to the test environment - git config --global user.email "you@example.com" - git config --global user.name "Your Name" - git config --global init.defaultBranch main + # Note: you need to log out and in again for the new group to take effect #+end_src ** Running Tests diff --git a/tests/server_shell.rs b/tests/server_shell.rs index bee0ed7..22f3d3b 100644 --- a/tests/server_shell.rs +++ b/tests/server_shell.rs @@ -203,6 +203,22 @@ fn push_git_repo(c: &TestContext, repo_name: &str) -> Assert { fn commit_dummy_content(c: &TestContext, repo_name: &str) -> Result<()> { let repo_dir = c.workdir.as_ref().join(repo_name); + Command::new("git") + .args(["config", "user.email", "shukkie@example.com"]) + .current_dir(&repo_dir) + .assert() + .success(); + Command::new("git") + .args(["config", "user.name", "Shukkie"]) + .current_dir(&repo_dir) + .assert() + .success(); + Command::new("git") + .args(["checkout", "-b", "main"]) + .current_dir(&repo_dir) + .assert() + .success(); + let file_name = "yay-a-file"; let file_path = repo_dir.join(file_name); fs::write(&file_path, "doesn't matter what this is")?; -- cgit v1.2.3