From 7c5892a196ce2474323c62abc6dc17e69abaa306 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Tue, 23 May 2017 16:04:26 +0200 Subject: [PATCH] test: use UniqueID prefix for check tests to unify log output --- command/agent/check_test.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/command/agent/check_test.go b/command/agent/check_test.go index 657e9de985..5dd3fe035e 100644 --- a/command/agent/check_test.go +++ b/command/agent/check_test.go @@ -28,7 +28,7 @@ func expectStatus(t *testing.T, script, status string) { CheckID: types.CheckID("foo"), Script: script, Interval: 10 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() defer check.Stop() @@ -71,7 +71,7 @@ func TestCheckMonitor_Timeout(t *testing.T) { Script: "sleep 1 && exit 0", Interval: 10 * time.Millisecond, Timeout: 5 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() defer check.Stop() @@ -95,7 +95,7 @@ func TestCheckMonitor_RandomStagger(t *testing.T) { CheckID: types.CheckID("foo"), Script: "exit 0", Interval: 25 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() defer check.Stop() @@ -120,7 +120,7 @@ func TestCheckMonitor_LimitOutput(t *testing.T) { CheckID: types.CheckID("foo"), Script: "od -N 81920 /dev/urandom", Interval: 25 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() defer check.Stop() @@ -140,7 +140,7 @@ func TestCheckTTL(t *testing.T) { Notify: notif, CheckID: types.CheckID("foo"), TTL: 100 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() defer check.Stop() @@ -211,7 +211,7 @@ func expectHTTPStatus(t *testing.T, url string, status string) { CheckID: types.CheckID("foo"), HTTP: url, Interval: 10 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() defer check.Stop() @@ -307,7 +307,7 @@ func TestCheckHTTPTimeout(t *testing.T) { HTTP: server.URL, Timeout: 5 * time.Millisecond, Interval: 10 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() @@ -328,7 +328,7 @@ func TestCheckHTTP_disablesKeepAlives(t *testing.T) { CheckID: types.CheckID("foo"), HTTP: "http://foo.bar/baz", Interval: 10 * time.Second, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() @@ -345,7 +345,7 @@ func TestCheckHTTP_TLSSkipVerify_defaultFalse(t *testing.T) { CheckID: "foo", HTTP: "https://foo.bar/baz", Interval: 10 * time.Second, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() @@ -368,7 +368,7 @@ func TestCheckHTTP_TLSSkipVerify_true_pass(t *testing.T) { CheckID: types.CheckID("skipverify_true"), HTTP: server.URL, Interval: 5 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), TLSSkipVerify: true, } @@ -397,7 +397,7 @@ func TestCheckHTTP_TLSSkipVerify_true_fail(t *testing.T) { CheckID: types.CheckID("skipverify_true"), HTTP: server.URL, Interval: 5 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), TLSSkipVerify: true, } check.Start() @@ -425,7 +425,7 @@ func TestCheckHTTP_TLSSkipVerify_false(t *testing.T) { CheckID: types.CheckID("skipverify_false"), HTTP: server.URL, Interval: 100 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), TLSSkipVerify: false, } @@ -472,7 +472,7 @@ func expectTCPStatus(t *testing.T, tcp string, status string) { CheckID: types.CheckID("foo"), TCP: tcp, Interval: 10 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), } check.Start() defer check.Stop() @@ -649,7 +649,7 @@ func expectDockerCheckStatus(t *testing.T, dockerClient DockerClient, status str DockerContainerID: "54432bad1fc7", Shell: "/bin/sh", Interval: 10 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), dockerClient: dockerClient, } check.Start() @@ -711,7 +711,7 @@ func TestDockerCheckDefaultToSh(t *testing.T) { Script: "/health.sh", DockerContainerID: "54432bad1fc7", Interval: 10 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), dockerClient: &fakeDockerClientWithNoErrors{}, } check.Start() @@ -733,7 +733,7 @@ func TestDockerCheckUseShellFromEnv(t *testing.T) { Script: "/health.sh", DockerContainerID: "54432bad1fc7", Interval: 10 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), dockerClient: &fakeDockerClientWithNoErrors{}, } check.Start() @@ -756,7 +756,7 @@ func TestDockerCheckTruncateOutput(t *testing.T) { DockerContainerID: "54432bad1fc7", Shell: "/bin/sh", Interval: 10 * time.Millisecond, - Logger: log.New(os.Stderr, "", log.LstdFlags), + Logger: log.New(os.Stderr, UniqueID(), log.LstdFlags), dockerClient: &fakeDockerClientWithLongOutput{}, } check.Start()