From 5191978bccc82d85ad41f4b1653c03681e0a7e04 Mon Sep 17 00:00:00 2001 From: Lyon Hill Date: Thu, 18 Apr 2019 16:19:08 -0600 Subject: [PATCH] update log test to actually look at the content of the logs --- task/servicetest/servicetest.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/task/servicetest/servicetest.go b/task/servicetest/servicetest.go index c9edbd9d827..7c08b590df6 100644 --- a/task/servicetest/servicetest.go +++ b/task/servicetest/servicetest.go @@ -1275,6 +1275,16 @@ func testLogsAcrossStorage(t *testing.T, sys *System) { } t.Fatalf("failed to get all logs: expected: 7 got: %d", len(logs)) } + smash := func(logs []*influxdb.Log) string { + smashed := "" + for _, log := range logs { + smashed = smashed + log.Message + } + return smashed + } + if smash(logs) != "0-00-10-21-01-11-21-3" { + t.Fatalf("log contents not acceptable, expected: %q, got: %q", "0-00-10-21-01-11-21-3", smash(logs)) + } logs, _, err = sys.TaskService.FindLogs(sys.Ctx, influxdb.LogFilter{Task: task.ID, Run: &rc1.Created.RunID}) if err != nil { @@ -1284,6 +1294,10 @@ func testLogsAcrossStorage(t *testing.T, sys *System) { t.Fatalf("failed to get all logs: expected: 4 got: %d", len(logs)) } + if smash(logs) != "1-01-11-21-3" { + t.Fatalf("log contents not acceptable, expected: %q, got: %q", "1-01-11-21-3", smash(logs)) + } + logs, _, err = sys.TaskService.FindLogs(sys.Ctx, influxdb.LogFilter{Task: task.ID, Run: &rc0.Created.RunID}) if err != nil { t.Fatal(err) @@ -1292,6 +1306,10 @@ func testLogsAcrossStorage(t *testing.T, sys *System) { t.Fatalf("failed to get all logs: expected: 3 got: %d", len(logs)) } + if smash(logs) != "0-00-10-2" { + t.Fatalf("log contents not acceptable, expected: %q, got: %q", "0-00-10-2", smash(logs)) + } + } func creds(t *testing.T, s *System) TestCreds {