forked from adamlaska/boulder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_test.go
More file actions
32 lines (25 loc) · 1.28 KB
/
main_test.go
File metadata and controls
32 lines (25 loc) · 1.28 KB
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
package notmain
import (
"testing"
"github.com/letsencrypt/boulder/test"
)
func TestLineValidAccepts(t *testing.T) {
err := lineValid("2020-07-06T18:07:43.109389+00:00 70877f679c72 datacenter 6 boulder-wfe[1595]: kKG6cwA Caught SIGTERM")
test.AssertNotError(t, err, "errored on valid checksum")
}
func TestLineValidRejects(t *testing.T) {
err := lineValid("2020-07-06T18:07:43.109389+00:00 70877f679c72 datacenter 6 boulder-wfe[1595]: xxxxxxx Caught SIGTERM")
test.AssertError(t, err, "didn't error on invalid checksum")
}
func TestLineValidRejectsNotAChecksum(t *testing.T) {
err := lineValid("2020-07-06T18:07:43.109389+00:00 70877f679c72 datacenter 6 boulder-wfe[1595]: xxxx Caught SIGTERM")
test.AssertError(t, err, "didn't error on invalid checksum")
test.AssertErrorIs(t, err, errInvalidChecksum)
}
func TestLineValidNonOurobouros(t *testing.T) {
err := lineValid("2020-07-06T18:07:43.109389+00:00 70877f679c72 datacenter 6 boulder-wfe[1595]: xxxxxxx Caught SIGTERM")
test.AssertError(t, err, "didn't error on invalid checksum")
selfOutput := "2020-07-06T18:07:43.109389+00:00 70877f679c72 datacenter 6 log-validator[1337]: xxxxxxx " + err.Error()
err2 := lineValid(selfOutput)
test.AssertNotError(t, err2, "expected no error when feeding lineValid's error output into itself")
}