Skip to content

Commit dda66ad

Browse files
bohdeGiteaBot
authored andcommitted
Avoid MacOS keychain dialog in integration tests (go-gitea#32813)
Mac's git installation ships with a system wide config that configures the credential helper `osxkeychain`, which will prompt the user with a dialog. ``` $ git config list --system credential.helper=osxkeychain ``` By setting the environment variable [`GIT_CONFIG_NOSYSTEM=true`](https://git-scm.com/docs/git-config#ENVIRONMENT), Git will not load the system wide config, preventing the dialog from populating. Closes go-gitea#26717
1 parent b54b6d1 commit dda66ad

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: tests/integration/integration_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ func TestMain(m *testing.M) {
118118
os.Unsetenv("GIT_COMMITTER_EMAIL")
119119
os.Unsetenv("GIT_COMMITTER_DATE")
120120

121+
// Avoid loading the default system config. On MacOS, this config
122+
// sets the osxkeychain credential helper, which will cause tests
123+
// to freeze with a dialog.
124+
os.Setenv("GIT_CONFIG_NOSYSTEM", "true")
125+
121126
err := unittest.InitFixtures(
122127
unittest.FixturesOptions{
123128
Dir: filepath.Join(filepath.Dir(setting.AppPath), "models/fixtures/"),

0 commit comments

Comments
 (0)