-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEVPROD-12824 Reset ~/.git-credentials between tasks (#8482)
- Loading branch information
1 parent
62fb931
commit 58fc889
Showing
4 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2734,28 +2734,36 @@ func (s *AgentSuite) TestClearsGitConfig() { | |
s.setupRunTask(defaultProjYml) | ||
// create a fake git config file | ||
gitConfigPath := filepath.Join(s.a.opts.HomeDirectory, ".gitconfig") | ||
gitConfigContents := ` | ||
gitCredentialsPath := filepath.Join(s.a.opts.HomeDirectory, ".git-credentials") | ||
contents := ` | ||
[user] | ||
name = foo bar | ||
email = [email protected] | ||
` | ||
err := os.WriteFile(gitConfigPath, []byte(gitConfigContents), 0600) | ||
err := os.WriteFile(gitConfigPath, []byte(contents), 0600) | ||
s.Require().NoError(err) | ||
s.Require().FileExists(gitConfigPath) | ||
|
||
err = os.WriteFile(gitCredentialsPath, []byte(contents), 0600) | ||
s.Require().NoError(err) | ||
s.Require().FileExists(gitCredentialsPath) | ||
|
||
s.a.runTeardownGroupCommands(s.ctx, s.tc) | ||
s.NoError(err) | ||
|
||
s.NoError(s.tc.logger.Close()) | ||
checkMockLogs(s.T(), s.mockCommunicator, s.tc.taskConfig.Task.Id, []string{ | ||
"Clearing git config.", | ||
"Cleared git config.", | ||
"Clearing git credentials.", | ||
"Cleared git credentials.", | ||
}, []string{ | ||
panicLog, | ||
"Running task commands failed", | ||
}) | ||
|
||
s.Assert().NoFileExists(gitConfigPath) | ||
s.Assert().NoFileExists(gitCredentialsPath) | ||
} | ||
|
||
func (s *AgentSuite) TestShouldRunSetupGroup() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters