aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Ascensão <rafa.almas@gmail.com>2018-12-10 20:55:08 +0000
committerRafael Ascensão <rafa.almas@gmail.com>2018-12-10 22:14:27 +0000
commit8dcd3d21cd5e1bf0312225a0db9506173ea76fc7 (patch)
treeb4d60d3208917c02f95a8808d893aa42ca7b203b
parent2ac2c8812ff343d2c4cade00d6ea17339d329fa8 (diff)
downloadgit-bug-8dcd3d21cd5e1bf0312225a0db9506173ea76fc7.tar.gz
tests: configure user ident in repos used by tests
Some git operations require the user to have an identity configured and will exit with failure if none is set (or if git can't guess it). As a direct consequence of this, the test suite may fail depending on the user local configuration. The error itself is justified as regular users *should* configure their identity themselves. However, when building in chrooted environments it's unlikely the git identity will be set making the test suite fail unnecessarily. To prevent such unnecessary failures, let's make a dummy identity for repos created and used by the test suite.
-rw-r--r--bug/bug_actions_test.go7
-rw-r--r--commands/select/select_test.go7
-rw-r--r--tests/read_bugs_test.go7
3 files changed, 21 insertions, 0 deletions
diff --git a/bug/bug_actions_test.go b/bug/bug_actions_test.go
index e68132fc..a60e5c68 100644
--- a/bug/bug_actions_test.go
+++ b/bug/bug_actions_test.go
@@ -31,6 +31,13 @@ func createRepo(bare bool) *repository.GitRepo {
log.Fatal(err)
}
+ if err := repo.StoreConfig("user.name", "testuser"); err != nil {
+ log.Fatal("failed to set user.name for test repository: ", err)
+ }
+ if err := repo.StoreConfig("user.email", "testuser@example.com"); err != nil {
+ log.Fatal("failed to set user.email for test repository: ", err)
+ }
+
return repo
}
diff --git a/commands/select/select_test.go b/commands/select/select_test.go
index 79c8cbf0..fe501d76 100644
--- a/commands/select/select_test.go
+++ b/commands/select/select_test.go
@@ -96,6 +96,13 @@ func createRepo() *repository.GitRepo {
log.Fatal(err)
}
+ if err := repo.StoreConfig("user.name", "testuser"); err != nil {
+ log.Fatal("failed to set user.name for test repository: ", err)
+ }
+ if err := repo.StoreConfig("user.email", "testuser@example.com"); err != nil {
+ log.Fatal("failed to set user.email for test repository: ", err)
+ }
+
return repo
}
diff --git a/tests/read_bugs_test.go b/tests/read_bugs_test.go
index b28da49b..e5de0cc2 100644
--- a/tests/read_bugs_test.go
+++ b/tests/read_bugs_test.go
@@ -31,6 +31,13 @@ func createRepo(bare bool) *repository.GitRepo {
log.Fatal(err)
}
+ if err := repo.StoreConfig("user.name", "testuser"); err != nil {
+ log.Fatal("failed to set user.name for test repository: ", err)
+ }
+ if err := repo.StoreConfig("user.email", "testuser@example.com"); err != nil {
+ log.Fatal("failed to set user.email for test repository: ", err)
+ }
+
return repo
}