feat(go): add 100k ingest hardening baseline
This commit is contained in:
24
go/vehicle-gateway/internal/loadsim/schedule_test.go
Normal file
24
go/vehicle-gateway/internal/loadsim/schedule_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package loadsim
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestConnectionBatchesSpreadsConnectionsByRate(t *testing.T) {
|
||||
got := ConnectionBatches(2500, 1000)
|
||||
want := []int{1000, 1000, 500}
|
||||
|
||||
if len(got) != len(want) {
|
||||
t.Fatalf("len = %d, want %d: %#v", len(got), len(want), got)
|
||||
}
|
||||
for i := range want {
|
||||
if got[i] != want[i] {
|
||||
t.Fatalf("batch[%d] = %d, want %d: %#v", i, got[i], want[i], got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestConnectionBatchesUsesOneBatchWhenTargetBelowRate(t *testing.T) {
|
||||
got := ConnectionBatches(300, 1000)
|
||||
if len(got) != 1 || got[0] != 300 {
|
||||
t.Fatalf("ConnectionBatches() = %#v, want []int{300}", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user