-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredisbench_test.go
44 lines (40 loc) · 1.17 KB
/
redisbench_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main_test
import (
"math/rand"
. "github.com/lcacciagioni/redisbench"
"github.com/rafaeljusto/redigomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Redisbench", func() {
c := redigomock.NewConn()
numMsg := rand.Intn(10000)
min := 1
max := 1000
Describe("With NodeStressString", func() {
result1 := NodeStressString(c, numMsg, min, max)
result2 := NodeStressString(c, numMsg, min, max)
It("Must return a result", func() {
Expect(result1).ToNot(Equal(StressResult{}))
Expect(result2).ToNot(Equal(StressResult{}))
})
Context("Given 2 runs results must not be equal", func() {
It("Must return 2 differen results", func() {
Expect(result1).ToNot(Equal(result2))
})
})
})
Describe("With NodeStressBytes", func() {
result1 := NodeStressBytes(c, numMsg, min, max)
result2 := NodeStressBytes(c, numMsg, min, max)
It("Must return a result", func() {
Expect(result1).ToNot(Equal(StressResult{}))
Expect(result2).ToNot(Equal(StressResult{}))
})
Context("Given 2 runs results must not be equal", func() {
It("Must return 2 differen results", func() {
Expect(result1).ToNot(Equal(result2))
})
})
})
})