-
Notifications
You must be signed in to change notification settings - Fork 18
/
event_test.go
47 lines (38 loc) · 1.32 KB
/
event_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
45
46
47
package goharvest
import (
"testing"
"github.com/google/uuid"
"github.com/obsidiandynamics/goharvest/metric"
"github.com/stretchr/testify/assert"
)
func TestLeaderAcquired_string(t *testing.T) {
leaderID, _ := uuid.NewRandom()
assert.Contains(t, LeaderAcquired{leaderID}.String(), "LeaderAcquired[")
assert.Contains(t, LeaderAcquired{leaderID}.String(), leaderID.String())
}
func TestLeaderAcquired_getter(t *testing.T) {
leaderID, _ := uuid.NewRandom()
e := LeaderAcquired{leaderID}
assert.Equal(t, leaderID, e.LeaderID())
}
func TestLeaderRefreshed_string(t *testing.T) {
leaderID, _ := uuid.NewRandom()
assert.Contains(t, LeaderRefreshed{leaderID}.String(), "LeaderRefreshed[")
assert.Contains(t, LeaderRefreshed{leaderID}.String(), leaderID.String())
}
func TestLeaderRefreshed_getter(t *testing.T) {
leaderID, _ := uuid.NewRandom()
e := LeaderRefreshed{leaderID}
assert.Equal(t, leaderID, e.LeaderID())
}
func TestLeaderRevoked_string(t *testing.T) {
assert.Equal(t, "LeaderRevoked[]", LeaderRevoked{}.String())
}
func TestLeaderFenced_string(t *testing.T) {
assert.Equal(t, "LeaderFenced[]", LeaderFenced{}.String())
}
func TestMeterStats_string(t *testing.T) {
stats := metric.MeterStats{}
assert.Contains(t, MeterRead{stats}.String(), "MeterRead[")
assert.Contains(t, MeterRead{stats}.String(), stats.String())
}