Skip to content

Commit

Permalink
update log test to actually look at the content of the logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lyondhill committed Apr 18, 2019
1 parent 0adde08 commit 5191978
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions task/servicetest/servicetest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit 5191978

Please sign in to comment.