No need for more than one client with internal concurrency
This commit is contained in:
10
main_test.go
10
main_test.go
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -20,8 +21,11 @@ func TestAttackRate(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
attack(targets, "random", 50, 1*time.Second, NewTextReporter())
|
||||
if hits := atomic.LoadUint64(&hitCount); hits != 50 {
|
||||
t.Fatalf("Wrong number of hits: want %d, got %d\n", 50, hits)
|
||||
rate := uint(5000)
|
||||
rep := NewTextReporter()
|
||||
attack(targets, "random", rate, 1*time.Second, rep)
|
||||
if hits := atomic.LoadUint64(&hitCount); uint(hits) != rate {
|
||||
rep.Report(os.Stdout)
|
||||
t.Fatalf("Wrong number of hits: want %d, got %d\n", rate, hits)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user