X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b02372d2d0ddb9ec7c8a70581b2f4358c6f9c825..e1c0d7735e1c3655628611a334ea794e76df1138:/lib/crunchrun/integration_test.go diff --git a/lib/crunchrun/integration_test.go b/lib/crunchrun/integration_test.go index 4f0100b267..38c589f698 100644 --- a/lib/crunchrun/integration_test.go +++ b/lib/crunchrun/integration_test.go @@ -148,6 +148,7 @@ func (s *integrationSuite) setup(c *C) { "state": s.cr.State, "command": s.cr.Command, "output_path": s.cr.OutputPath, + "output_glob": s.cr.OutputGlob, "container_image": s.cr.ContainerImage, "mounts": s.cr.Mounts, "runtime_constraints": s.cr.RuntimeConstraints, @@ -221,6 +222,8 @@ func (s *integrationSuite) TestRunTrivialContainerWithLocalKeepstore(c *C) { if trial.logConfig == "none" { c.Check(logExists, Equals, false) } else { + c.Check(log, Matches, `(?ms).*not running trash worker.*`) + c.Check(log, Matches, `(?ms).*not running trash emptier.*`) c.Check(log, trial.matchGetReq, `(?ms).*"reqMethod":"GET".*`) c.Check(log, trial.matchPutReq, `(?ms).*"reqMethod":"PUT".*,"reqPath":"0e3bcff26d51c895a60ea0d4585e134d".*`) } @@ -272,6 +275,19 @@ func (s *integrationSuite) TestRunTrivialContainerWithNoLocalKeepstore(c *C) { c.Check(s.logFiles["crunch-run.txt"], Matches, `(?ms).*loaded config file \Q`+os.Getenv("ARVADOS_CONFIG")+`\E\n.*`) } +func (s *integrationSuite) TestRunTrivialContainerWithOutputGlob(c *C) { + s.cr.OutputGlob = []string{"js?n"} + s.testRunTrivialContainer(c) + fs, err := s.outputCollection.FileSystem(s.client, s.kc) + c.Assert(err, IsNil) + _, err = fs.Stat("json") + c.Check(err, IsNil) + _, err = fs.Stat("inputfile") + c.Check(err, Equals, os.ErrNotExist) + _, err = fs.Stat("emptydir") + c.Check(err, Equals, os.ErrNotExist) +} + func (s *integrationSuite) testRunTrivialContainer(c *C) { if err := exec.Command("which", s.engine).Run(); err != nil { c.Skip(fmt.Sprintf("%s: %s", s.engine, err)) @@ -321,34 +337,37 @@ func (s *integrationSuite) testRunTrivialContainer(c *C) { var output arvados.Collection err = s.client.RequestAndDecode(&output, "GET", "arvados/v1/collections/"+s.cr.OutputUUID, nil, nil) c.Assert(err, IsNil) - fs, err = output.FileSystem(s.client, s.kc) - c.Assert(err, IsNil) - if f, err := fs.Open("inputfile"); c.Check(err, IsNil) { - defer f.Close() - buf, err := ioutil.ReadAll(f) - c.Check(err, IsNil) - c.Check(string(buf), Equals, "inputdata") - } - if f, err := fs.Open("json"); c.Check(err, IsNil) { - defer f.Close() - buf, err := ioutil.ReadAll(f) - c.Check(err, IsNil) - c.Check(string(buf), Equals, `["foo",{"foo":"bar"},null]`) - } - if fi, err := fs.Stat("emptydir"); c.Check(err, IsNil) { - c.Check(fi.IsDir(), Equals, true) - } - if d, err := fs.Open("emptydir"); c.Check(err, IsNil) { - defer d.Close() - fis, err := d.Readdir(-1) + s.outputCollection = output + + if len(s.cr.OutputGlob) == 0 { + fs, err = output.FileSystem(s.client, s.kc) c.Assert(err, IsNil) - // crunch-run still saves a ".keep" file to preserve - // empty dirs even though that shouldn't be - // necessary. Ideally we would do: - // c.Check(fis, HasLen, 0) - for _, fi := range fis { - c.Check(fi.Name(), Equals, ".keep") + if f, err := fs.Open("inputfile"); c.Check(err, IsNil) { + defer f.Close() + buf, err := ioutil.ReadAll(f) + c.Check(err, IsNil) + c.Check(string(buf), Equals, "inputdata") + } + if f, err := fs.Open("json"); c.Check(err, IsNil) { + defer f.Close() + buf, err := ioutil.ReadAll(f) + c.Check(err, IsNil) + c.Check(string(buf), Equals, `["foo",{"foo":"bar"},null]`) + } + if fi, err := fs.Stat("emptydir"); c.Check(err, IsNil) { + c.Check(fi.IsDir(), Equals, true) + } + if d, err := fs.Open("emptydir"); c.Check(err, IsNil) { + defer d.Close() + fis, err := d.Readdir(-1) + c.Assert(err, IsNil) + // crunch-run still saves a ".keep" file to preserve + // empty dirs even though that shouldn't be + // necessary. Ideally we would do: + // c.Check(fis, HasLen, 0) + for _, fi := range fis { + c.Check(fi.Name(), Equals, ".keep") + } } } - s.outputCollection = output }