forked from letsencrypt/boulder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mon_conf_test.go
37 lines (34 loc) · 872 Bytes
/
mon_conf_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
package observer
import (
"testing"
"time"
"github.com/letsencrypt/boulder/config"
"github.com/letsencrypt/boulder/test"
)
func TestMonConf_validatePeriod(t *testing.T) {
type fields struct {
Period config.Duration
}
tests := []struct {
name string
fields fields
wantErr bool
}{
{"valid", fields{config.Duration{Duration: 1 * time.Microsecond}}, false},
{"1 nanosecond", fields{config.Duration{Duration: 1 * time.Nanosecond}}, true},
{"none supplied", fields{config.Duration{}}, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &MonConf{
Period: tt.fields.Period,
}
err := c.validatePeriod()
if tt.wantErr {
test.AssertError(t, err, "MonConf.validatePeriod() should have errored")
} else {
test.AssertNotError(t, err, "MonConf.validatePeriod() shouldn't have errored")
}
})
}
}