X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2f83fcd45b4b23db2bb5bb4afbe1e863ebd77ec6..b1ffc878a5ea6ba083b8fbc8f20c15c7a6f1e1ec:/lib/crunchrun/logging_test.go diff --git a/lib/crunchrun/logging_test.go b/lib/crunchrun/logging_test.go index 42f165fd75..ee3320c7c3 100644 --- a/lib/crunchrun/logging_test.go +++ b/lib/crunchrun/logging_test.go @@ -67,7 +67,7 @@ func (s *LoggingTestSuite) TestWriteLogs(c *C) { c.Check(api.Content[0]["log"].(arvadosclient.Dict)["event_type"], Equals, "crunch-run") c.Check(api.Content[0]["log"].(arvadosclient.Dict)["properties"].(map[string]string)["text"], Equals, logtext) - c.Check(string(kc.Content), Equals, logtext) + s.checkWroteBlock(c, kc, "74561df9ae65ee9f35d5661d42454264+83", logtext) } func (s *LoggingTestSuite) TestWriteLogsLarge(c *C) { @@ -224,7 +224,14 @@ func (s *LoggingTestSuite) testWriteLogsWithRateLimit(c *C, throttleParam string c.Check(api.Content[0]["log"].(arvadosclient.Dict)["event_type"], Equals, "crunch-run") stderrLog := api.Content[0]["log"].(arvadosclient.Dict)["properties"].(map[string]string)["text"] c.Check(true, Equals, strings.Contains(stderrLog, expected)) - c.Check(string(kc.Content), Equals, logtext) + s.checkWroteBlock(c, kc, "74561df9ae65ee9f35d5661d42454264+83", logtext) +} + +func (s *LoggingTestSuite) checkWroteBlock(c *C, kc *KeepTestClient, locator, expect string) { + buf := make([]byte, len([]byte(expect))+1) + n, err := kc.ReadAt(locator, buf, 0) + c.Check(err, IsNil) + c.Check(string(buf[:n]), Equals, expect) } type filterSuite struct{}