Limit number of concurrent goroutines
This commit is contained in:
parent
5fd9bc851b
commit
62dadc53bf
12 changed files with 206 additions and 103 deletions
|
|
@ -109,9 +109,7 @@ func TestCommandRepositoryDoesNotExists(t *testing.T) {
|
|||
Dest: tmpDirWithInitialRepository.rootFS.Root(),
|
||||
}
|
||||
|
||||
ch := make(chan CommandStatus)
|
||||
go sc.Command(repoCfg, ch)
|
||||
repoStatus := <-ch
|
||||
repoStatus := sc.Command(repoCfg)
|
||||
expectedMessage := "repository does not exist"
|
||||
|
||||
if !repoStatus.Error {
|
||||
|
|
@ -149,10 +147,7 @@ func TestCommandRepositoryNoRemoteBranch(t *testing.T) {
|
|||
Dest: dirNameForLocalRepository,
|
||||
}
|
||||
|
||||
ch := make(chan CommandStatus)
|
||||
|
||||
go sc.Command(repoCfg, ch)
|
||||
repoStatus := <-ch
|
||||
repoStatus := sc.Command(repoCfg)
|
||||
expectedMessage := "cannot find remote branches"
|
||||
|
||||
if !repoStatus.Error {
|
||||
|
|
@ -171,9 +166,7 @@ func TestCommandAllCorrectWithoutChanges(t *testing.T) {
|
|||
|
||||
sc, _, repoCfg, _ := getBaseForTestingSyncCommand()
|
||||
|
||||
ch := make(chan CommandStatus)
|
||||
go sc.Command(repoCfg, ch)
|
||||
repoStatus := <-ch
|
||||
repoStatus := sc.Command(repoCfg)
|
||||
expectedMessage := "branch master - ( | origin | \u21910 \u21930 )"
|
||||
|
||||
if repoStatus.Error {
|
||||
|
|
@ -191,15 +184,12 @@ func TestCommandAllCorrectWithOneChange(t *testing.T) {
|
|||
|
||||
sc, fakeLocalRepository, repoCfg, _ := getBaseForTestingSyncCommand()
|
||||
|
||||
ch := make(chan CommandStatus)
|
||||
|
||||
fakeLocalWorkTree, err := fakeLocalRepository.Worktree()
|
||||
checkErrorDuringPreparation(err)
|
||||
|
||||
makeCommit(fakeLocalWorkTree, "commit 1")
|
||||
|
||||
go sc.Command(repoCfg, ch)
|
||||
repoStatus := <-ch
|
||||
repoStatus := sc.Command(repoCfg)
|
||||
expectedMessage := "branch master - ( | origin | \u21911 \u21930 )"
|
||||
|
||||
if repoStatus.Message != expectedMessage {
|
||||
|
|
@ -220,9 +210,7 @@ func TestCommandAllCorrectWithOneChange(t *testing.T) {
|
|||
func TestCommandMultiRemoteNoChanges(t *testing.T) {
|
||||
|
||||
sc, _, repoCfg := getBaseForTestingSyncMultipleRemote()
|
||||
ch := make(chan CommandStatus)
|
||||
go sc.Command(repoCfg, ch)
|
||||
repoStatus := <-ch
|
||||
repoStatus := sc.Command(repoCfg)
|
||||
expectedMessage := "branch master - ( | origin | \u21910 \u21930 ) - ( | subremote | \u21910 \u21930 )"
|
||||
|
||||
if repoStatus.Error {
|
||||
|
|
@ -246,9 +234,7 @@ func TestCommandMultiRemoteWithOneChange(t *testing.T) {
|
|||
makeCommit(fakeLocalWorkTree, "commit 1")
|
||||
checkErrorDuringPreparation(err)
|
||||
|
||||
ch := make(chan CommandStatus)
|
||||
go sc.Command(repoCfg, ch)
|
||||
repoStatus := <-ch
|
||||
repoStatus := sc.Command(repoCfg)
|
||||
expectedMessage := "branch master - ( | origin | \u21911 \u21930 ) - ( | subremote | \u21911 \u21930 )"
|
||||
|
||||
if repoStatus.Error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue