aboutsummaryrefslogtreecommitdiffstats
path: root/tests/read_bugs_test.go
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 /tests/read_bugs_test.go
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.
Diffstat (limited to 'tests/read_bugs_test.go')
-rw-r--r--tests/read_bugs_test.go7
1 files changed, 7 insertions, 0 deletions
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
}