test: add buffer to prevent goroutine leak

Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
This commit is contained in:
Ziheng Liu
2020-02-25 17:13:25 -05:00
parent d706420b5d
commit c322af8019
22 changed files with 63 additions and 45 deletions

View File

@@ -82,8 +82,8 @@ func testConcurrentPullWholeRepo(c *testing.T) {
dockerCmd(c, args...)
// Run multiple re-pulls concurrently
results := make(chan error)
numPulls := 3
results := make(chan error, numPulls)
for i := 0; i != numPulls; i++ {
go func() {
@@ -120,8 +120,8 @@ func testConcurrentFailingPull(c *testing.T) {
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
// Run multiple pulls concurrently
results := make(chan error)
numPulls := 3
results := make(chan error, numPulls)
for i := 0; i != numPulls; i++ {
go func() {
@@ -170,7 +170,7 @@ func testConcurrentPullMultipleTags(c *testing.T) {
dockerCmd(c, args...)
// Re-pull individual tags, in parallel
results := make(chan error)
results := make(chan error, len(repos))
for _, repo := range repos {
go func(repo string) {