adjust for loop

Signed-off-by: spacexnice <yaoyao.xyy@alibaba-inc.com>
This commit is contained in:
spacexnice 2016-08-24 09:31:27 +08:00
parent 44b8157572
commit ca2b78dc0a

View file

@ -103,35 +103,24 @@ func testAuthChallengeConcurrent(t *testing.T, host string) {
var s sync.WaitGroup var s sync.WaitGroup
s.Add(2) s.Add(2)
go func() { go func() {
i := 200
for { for i:=0 ; i<200; i++ {
//time.Sleep(500 * time.Millisecond)
err = scm.AddResponse(resp) err = scm.AddResponse(resp)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
i = i -1
if i < 0{
break
}
} }
s.Done() s.Done()
}() }()
go func() { go func() {
lowered := *url lowered := *url
lowered.Host = strings.ToLower(lowered.Host) lowered.Host = strings.ToLower(lowered.Host)
k:= 200 for k := 0; k < 200 ; k++ {
for {
_, err := scm.GetChallenges(lowered) _, err := scm.GetChallenges(lowered)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
k = k -1
if k < 0{
break
}
} }
s.Done() s.Done()
}() }()
s.Wait() s.Wait()