Skip to content

Commit 1f44abc

Browse files
committed
Fix tests for AuditNotice, add AuditErr to tests
1 parent db8bea7 commit 1f44abc

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

log/audit-logger_test.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ func TestConstructionNil(t *testing.T) {
7070

7171
func TestEmit(t *testing.T) {
7272
t.Parallel()
73-
audit := setup(t)
73+
log := setup(t)
7474

75-
audit.Audit("test message")
75+
log.AuditNotice("test message")
7676
}
7777

7878
func TestEmitEmpty(t *testing.T) {
7979
t.Parallel()
80-
audit := setup(t)
80+
log := setup(t)
8181

82-
audit.Audit("")
82+
log.AuditNotice("")
8383
}
8484

8585
func TestEmitErrors(t *testing.T) {
@@ -94,7 +94,8 @@ func TestSyslogMethods(t *testing.T) {
9494
t.Parallel()
9595
audit := setup(t)
9696

97-
audit.Audit("audit-logger_test.go: audit-notice")
97+
audit.AuditNotice("audit-logger_test.go: audit-notice")
98+
audit.AuditErr(errors.New("audit-logger_test.go: audit-err"))
9899
audit.Crit("audit-logger_test.go: critical")
99100
audit.Debug("audit-logger_test.go: debug")
100101
audit.Emerg("audit-logger_test.go: emerg")
@@ -178,7 +179,11 @@ func TestTransmission(t *testing.T) {
178179

179180
data := make([]byte, 128)
180181

181-
audit.Audit("audit-logger_test.go: audit-notice")
182+
audit.AuditNotice("audit-logger_test.go: audit-notice")
183+
_, _, err = l.ReadFrom(data)
184+
test.AssertNotError(t, err, "Failed to find packet")
185+
186+
audit.AuditErr(errors.New("audit-logger_test.go: audit-err"))
182187
_, _, err = l.ReadFrom(data)
183188
test.AssertNotError(t, err, "Failed to find packet")
184189

0 commit comments

Comments
 (0)