Add a skip field to the repository configuration
This commit is contained in:
parent
62dadc53bf
commit
19e68df732
4 changed files with 74 additions and 2 deletions
|
|
@ -139,6 +139,11 @@ func (g *GitRepositoryManager) runCommand(cmd commands.Command) {
|
|||
|
||||
var wg sync.WaitGroup
|
||||
for _, repo := range g.configuration.Repositories {
|
||||
|
||||
if repo.Skip && !g.cliArguments.IgnoreSkipped {
|
||||
continue
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
go func(r config.RepositoryConfig) {
|
||||
|
|
|
|||
|
|
@ -371,3 +371,63 @@ func TestDescribeStatusNoChangeColor(t *testing.T) {
|
|||
|
||||
describeStatus(status)
|
||||
}
|
||||
|
||||
func TestSkipRepository(t *testing.T) {
|
||||
grm := GitRepositoryManager{
|
||||
cliArguments: config.CliArguments{
|
||||
LimitToTags: []string{"example"},
|
||||
Routines: 10,
|
||||
},
|
||||
configuration: config.Configuration{
|
||||
Repositories: []config.RepositoryConfig{
|
||||
{Name: "example1"},
|
||||
{Name: "example2", Skip: true},
|
||||
{Name: "example3"},
|
||||
},
|
||||
},
|
||||
}
|
||||
fakeCommand := FakeCommandToTest{
|
||||
triggerError: false,
|
||||
triggerChanged: false,
|
||||
}
|
||||
emt := ExpectedMessageTester{
|
||||
expectedMessages: []string{
|
||||
"Repository \"example1\": response from fake command\n",
|
||||
"Repository \"example3\": response from fake command\n",
|
||||
},
|
||||
}
|
||||
echo.Color(false)
|
||||
echo.Output(emt)
|
||||
grm.runCommand(fakeCommand)
|
||||
}
|
||||
|
||||
func TestSkipRepositoryWithIgnore(t *testing.T) {
|
||||
grm := GitRepositoryManager{
|
||||
cliArguments: config.CliArguments{
|
||||
LimitToTags: []string{"example"},
|
||||
Routines: 10,
|
||||
IgnoreSkipped: true,
|
||||
},
|
||||
configuration: config.Configuration{
|
||||
Repositories: []config.RepositoryConfig{
|
||||
{Name: "example1"},
|
||||
{Name: "example2", Skip: true},
|
||||
{Name: "example3"},
|
||||
},
|
||||
},
|
||||
}
|
||||
fakeCommand := FakeCommandToTest{
|
||||
triggerError: false,
|
||||
triggerChanged: false,
|
||||
}
|
||||
emt := ExpectedMessageTester{
|
||||
expectedMessages: []string{
|
||||
"Repository \"example1\": response from fake command\n",
|
||||
"Repository \"example2\": response from fake command\n",
|
||||
"Repository \"example3\": response from fake command\n",
|
||||
},
|
||||
}
|
||||
echo.Color(false)
|
||||
echo.Output(emt)
|
||||
grm.runCommand(fakeCommand)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue