summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-04-29 20:26:25 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-04-29 20:26:25 +0200
commit97426387ce06a3c9622a919fea0b3d7b04c68e72 (patch)
tree4eff972f7191eef6b417258fd3a0657684dff8fa
parentd60ac28946bc30c36610d17067400af286625d9f (diff)
Add required user config for tests into the tests
-rw-r--r--readme.org10
-rw-r--r--tests/server_shell.rs16
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")?;