-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEVPROD-10373 Reset global git config at the end of every task (#8322)
- Loading branch information
1 parent
bd7a267
commit 6dde371
Showing
10 changed files
with
88 additions
and
11 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 |
---|---|---|
|
@@ -112,6 +112,7 @@ func (s *AgentSuite) SetupTest() { | |
LogOutput: globals.LogOutputStdout, | ||
LogPrefix: "agent", | ||
WorkingDirectory: s.testTmpDirName, | ||
HomeDirectory: s.suiteTmpDirName, | ||
}, | ||
comm: client.NewMock("url"), | ||
tracer: otel.GetTracerProvider().Tracer("noop_tracer"), | ||
|
@@ -2729,6 +2730,34 @@ tasks: | |
s.Equal(expectedLines, actualLines) | ||
} | ||
|
||
func (s *AgentSuite) TestClearsGitConfig() { | ||
s.setupRunTask(defaultProjYml) | ||
// create a fake git config file | ||
gitConfigPath := filepath.Join(s.a.opts.HomeDirectory, ".gitconfig") | ||
gitConfigContents := ` | ||
[user] | ||
name = foo bar | ||
email = [email protected] | ||
` | ||
err := os.WriteFile(gitConfigPath, []byte(gitConfigContents), 0600) | ||
s.Require().NoError(err) | ||
s.Require().FileExists(gitConfigPath) | ||
|
||
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.", | ||
}, []string{ | ||
panicLog, | ||
"Running task commands failed", | ||
}) | ||
|
||
s.Assert().NoFileExists(gitConfigPath) | ||
} | ||
|
||
func (s *AgentSuite) TestShouldRunSetupGroup() { | ||
nextTask := &apimodels.NextTaskResponse{ | ||
TaskGroup: "", | ||
|
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
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
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
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