From ca2b78dc0acacce4c0e4e1013098855dbae42720 Mon Sep 17 00:00:00 2001 From: spacexnice Date: Wed, 24 Aug 2016 09:31:27 +0800 Subject: [PATCH] adjust for loop Signed-off-by: spacexnice --- registry/client/auth/authchallenge_test.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/registry/client/auth/authchallenge_test.go b/registry/client/auth/authchallenge_test.go index e4f81d28..f1b321a7 100644 --- a/registry/client/auth/authchallenge_test.go +++ b/registry/client/auth/authchallenge_test.go @@ -103,35 +103,24 @@ func testAuthChallengeConcurrent(t *testing.T, host string) { var s sync.WaitGroup s.Add(2) go func() { - i := 200 - for { - //time.Sleep(500 * time.Millisecond) + + for i:=0 ; i<200; i++ { err = scm.AddResponse(resp) if err != nil { t.Fatal(err) } - i = i -1 - if i < 0{ - break - } } s.Done() }() go func() { lowered := *url lowered.Host = strings.ToLower(lowered.Host) - k:= 200 - for { + for k := 0; k < 200 ; k++ { _, err := scm.GetChallenges(lowered) if err != nil { t.Fatal(err) } - k = k -1 - if k < 0{ - break - } } - s.Done() }() s.Wait()