"git.arvados.org/arvados.git/sdk/go/arvados"
"git.arvados.org/arvados.git/sdk/go/arvadosclient"
"git.arvados.org/arvados.git/sdk/go/arvadostest"
- "git.arvados.org/arvados.git/sdk/go/manifest"
. "gopkg.in/check.v1"
)
return errors.New("not implemented")
}
-func (client *KeepTestClient) ManifestFileReader(m manifest.Manifest, filename string) (arvados.File, error) {
- if filename == hwImageID+".tar" {
- rdr := ioutil.NopCloser(&bytes.Buffer{})
- client.Called = true
- return FileWrapper{rdr, 1321984}, nil
- } else if filename == "/file1_in_main.txt" {
- rdr := ioutil.NopCloser(strings.NewReader("foo"))
- client.Called = true
- return FileWrapper{rdr, 3}, nil
- }
- return nil, nil
-}
-
type apiStubServer struct {
server *httptest.Server
proxy *httputil.ReverseProxy
intercept func(http.ResponseWriter, *http.Request) bool
container arvados.Container
- logs map[string]string
}
func apiStub() (*arvados.Client, *apiStubServer) {
if apistub.intercept != nil && apistub.intercept(w, r) {
return
}
- if r.Method == "POST" && r.URL.Path == "/arvados/v1/logs" {
- var body struct {
- Log struct {
- EventType string `json:"event_type"`
- Properties struct {
- Text string
- }
- }
- }
- json.NewDecoder(r.Body).Decode(&body)
- apistub.logs[body.Log.EventType] += body.Log.Properties.Text
- return
- }
if r.Method == "GET" && r.URL.Path == "/arvados/v1/collections/"+hwPDH {
json.NewEncoder(w).Encode(arvados.Collection{ManifestText: hwManifest})
return
KeepTestClient
}
-func (*KeepErrorTestClient) ManifestFileReader(manifest.Manifest, string) (arvados.File, error) {
- return nil, errors.New("KeepError")
-}
-
func (*KeepErrorTestClient) BlockWrite(context.Context, arvados.BlockWriteOptions) (arvados.BlockWriteResponse, error) {
return arvados.BlockWriteResponse{}, errors.New("KeepError")
}
return 0, errors.New("KeepError")
}
-type ErrorReader struct {
- FileWrapper
-}
-
-func (ErrorReader) Read(p []byte) (n int, err error) {
- return 0, errors.New("ErrorReader")
-}
-
-func (ErrorReader) Seek(int64, int) (int64, error) {
- return 0, errors.New("ErrorReader")
-}
-
-func (*KeepReadErrorTestClient) ManifestFileReader(m manifest.Manifest, filename string) (arvados.File, error) {
- return ErrorReader{}, nil
-}
-
func dockerLog(fd byte, msg string) []byte {
by := []byte(msg)
header := make([]byte, 8+len(by))
err = s.runner.WaitFinish()
c.Assert(err, IsNil)
- c.Check(logFileContent(c, s.runner, "stdout.txt"), Matches, `Hello world\n`)
+ c.Check(logFileContent(c, s.runner, "stdout.txt"), Matches, `2\S+Z Hello world\n`)
c.Check(logFileContent(c, s.runner, "stderr.txt"), Matches, ``)
}
c.Check(s.api.CalledWith("container.exit_code", 0), NotNil)
c.Check(s.api.CalledWith("container.state", "Complete"), NotNil)
- c.Check(logFileContent(c, s.runner, "stdout.txt"), Matches, "hello world\n")
+ c.Check(logFileContent(c, s.runner, "stdout.txt"), Matches, `2\S+Z hello world\n`)
c.Check(s.testDispatcherKeepClient.StorageClasses, DeepEquals, []string{"default"})
c.Check(s.testContainerKeepClient.StorageClasses, DeepEquals, []string{"default"})
}
c.Check(s.api.CalledWith("container.exit_code", 0), NotNil)
c.Check(s.api.CalledWith("container.state", "Complete"), NotNil)
- c.Check(logFileContent(c, s.runner, "crunchstat.txt"), Matches, `(?ms).*mem \d+ swap \d+ pgmajfault \d+ rss.*`)
+ c.Check(logFileContent(c, s.runner, "crunchstat.txt"), Matches, `(?ms).*`+reTimestamp+` mem \d+ swap \d+ pgmajfault \d+ rss.*`)
+ c.Check(logFileContent(c, s.runner, "hoststat.txt"), Matches, `(?ms).*`+reTimestamp+` mem \d+ swap \d+ pgmajfault \d+ rss.*`)
// Check that we called (*crunchstat.Reporter)Stop().
- c.Check(logFileContent(c, s.runner, "crunch-run.txt"), Matches, `(?ms).*Maximum crunch-run memory rss usage was \d+ bytes\n.*`)
+ c.Check(logFileContent(c, s.runner, "crunch-run.txt"), Matches, `(?ms).*`+reTimestamp+` Maximum crunch-run memory rss usage was \d+ bytes\n.*`)
}
func (s *TestSuite) TestNodeInfoLog(c *C) {
})
c.Check(s.api.CalledWith("container.exit_code", 3), NotNil)
c.Check(s.api.CalledWith("container.state", "Complete"), NotNil)
- c.Check(logFileContent(c, s.runner, "crunch-run.txt"), Matches, `(?ms).*status code 3\n.*`)
+ c.Check(logFileContent(c, s.runner, "crunch-run.txt"), Matches, `(?ms).*`+reTimestamp+` Container exited with status code 3\n.*`)
}
func (s *TestSuite) TestFullRunSetOutput(c *C) {
c.Check(s.api.CalledWith("container.runtime_status.warning", "arv-mount: Keep write error"), NotNil)
c.Check(s.api.CalledWith("container.runtime_status.warningDetail", "Test: Keep write error: I am a teapot"), NotNil)
c.Check(s.api.CalledWith("container.state", "Complete"), NotNil)
- c.Check(logFileContent(c, s.runner, "crunch-run.txt"), Matches, `(?ms).*Container exited with status code 137 \(signal 9, SIGKILL\).*`)
+ c.Check(logFileContent(c, s.runner, "crunch-run.txt"), Matches, `(?ms).*`+reTimestamp+` Container exited with status code 137 \(signal 9, SIGKILL\).*`)
+ c.Check(logFileContent(c, s.runner, "arv-mount.txt"), Matches, reTimestamp+` Test: Keep write error: I am a teapot\n`)
}
func (s *TestSuite) TestStdoutWithExcludeFromOutputMountPointUnderOutputDir(c *C) {