var _ = Suite(&TestSuite{})
type ArvTestClient struct {
+ c *C
+ manifest string
+ success bool
}
func (t ArvTestClient) Create(resourceType string, parameters arvadosclient.Dict, output interface{}) error {
}
func (t ArvTestClient) Update(resourceType string, uuid string, parameters arvadosclient.Dict, output interface{}) (err error) {
+ t.c.Check(resourceType, Equals, "job_tasks")
+ t.c.Check(parameters, DeepEquals, arvadosclient.Dict{"job_task": Task{
+ output: t.manifest,
+ success: t.success,
+ progress: 1}})
return nil
}
}
func (s *TestSuite) TestSimpleRun(c *C) {
-
- api := ArvTestClient{}
-
tmpdir, _ := ioutil.TempDir("", "")
defer func() {
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c, "", true},
+ KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
}
func (s *TestSuite) TestSimpleRunSubtask(c *C) {
-
- api := ArvTestClient{}
-
tmpdir, _ := ioutil.TempDir("", "")
defer func() {
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c,
+ ". d3b07384d113edec49eaa6238ad5ff00+4 0:4:output.txt\n", true},
+ KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
}
func (s *TestSuite) TestRedirect(c *C) {
-
- api := ArvTestClient{}
-
tmpfile, _ := ioutil.TempFile("", "")
tmpfile.Write([]byte("foo\n"))
tmpfile.Close()
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c,
+ ". d3b07384d113edec49eaa6238ad5ff00+4 0:4:output.txt\n", true},
+ KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
}
func (s *TestSuite) TestEnv(c *C) {
-
- api := ArvTestClient{}
-
tmpdir, _ := ioutil.TempDir("", "")
defer func() {
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c, ". d3b07384d113edec49eaa6238ad5ff00+4 0:4:output.txt\n", true},
+ KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
os.RemoveAll(tmpdir)
}()
- err := runner(&api,
+ err := runner(&api, KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
}
func (s *TestSuite) TestRunFail(c *C) {
-
- api := ArvTestClient{}
-
tmpdir, _ := ioutil.TempDir("", "")
defer func() {
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c, "", false}, KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
}
func (s *TestSuite) TestRunSuccessCode(c *C) {
-
- api := ArvTestClient{}
-
tmpdir, _ := ioutil.TempDir("", "")
defer func() {
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c, "", true}, KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
}
func (s *TestSuite) TestRunFailCode(c *C) {
- api := ArvTestClient{}
-
tmpdir, _ := ioutil.TempDir("", "")
defer func() {
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c, "", false}, KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
}
func (s *TestSuite) TestRunTempFailCode(c *C) {
- api := ArvTestClient{}
-
tmpdir, _ := ioutil.TempDir("", "")
defer func() {
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c, "", false}, KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,
}
func (s *TestSuite) TestVwd(c *C) {
- api := ArvTestClient{}
-
tmpfile, _ := ioutil.TempFile("", "")
tmpfile.Write([]byte("foo\n"))
tmpfile.Close()
os.RemoveAll(tmpdir)
}()
- err := runner(api,
+ err := runner(ArvTestClient{c, ". d3b07384d113edec49eaa6238ad5ff00+4 0:4:output.txt\n", true},
+ KeepTestClient{},
"zzzz-8i9sb-111111111111111",
"zzzz-ot0gb-111111111111111",
tmpdir,