Commit 37c11dc0 authored by Alberto Donizetti's avatar Alberto Donizetti Committed by Brad Fitzpatrick

log/syslog: skip tests that depend on daemon on builders

Some functions in log/syslog depend on syslogd running. Instead of
treating errors caused by the daemon not running as test failures,
ignore them and skip the test.

Fixes the longtest builder.

Change-Id: I628fe4aab5f1a505edfc0748861bb976ed5917ea
Reviewed-on: https://go-review.googlesource.com/113838
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent faa69b90
...@@ -214,6 +214,9 @@ func TestNew(t *testing.T) { ...@@ -214,6 +214,9 @@ func TestNew(t *testing.T) {
s, err := New(LOG_INFO|LOG_USER, "the_tag") s, err := New(LOG_INFO|LOG_USER, "the_tag")
if err != nil { if err != nil {
if err.Error() == "Unix syslog delivery error" {
t.Skip("skipping: syslogd not running")
}
t.Fatalf("New() failed: %s", err) t.Fatalf("New() failed: %s", err)
} }
// Don't send any messages. // Don't send any messages.
...@@ -226,6 +229,9 @@ func TestNewLogger(t *testing.T) { ...@@ -226,6 +229,9 @@ func TestNewLogger(t *testing.T) {
} }
f, err := NewLogger(LOG_USER|LOG_INFO, 0) f, err := NewLogger(LOG_USER|LOG_INFO, 0)
if f == nil { if f == nil {
if err.Error() == "Unix syslog delivery error" {
t.Skip("skipping: syslogd not running")
}
t.Error(err) t.Error(err)
} }
} }
...@@ -244,6 +250,9 @@ func TestDial(t *testing.T) { ...@@ -244,6 +250,9 @@ func TestDial(t *testing.T) {
} }
l, err := Dial("", "", LOG_USER|LOG_ERR, "syslog_test") l, err := Dial("", "", LOG_USER|LOG_ERR, "syslog_test")
if err != nil { if err != nil {
if err.Error() == "Unix syslog delivery error" {
t.Skip("skipping: syslogd not running")
}
t.Fatalf("Dial() failed: %s", err) t.Fatalf("Dial() failed: %s", err)
} }
l.Close() l.Close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment