X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/89f541d2b534b9cad4ee668f702f1270bf056171..ad82cb7409dd62c3ac251e4f98d82ce774f6f528:/lib/crunchrun/crunchrun_test.go diff --git a/lib/crunchrun/crunchrun_test.go b/lib/crunchrun/crunchrun_test.go index 4b1bf84255..fa34adf50e 100644 --- a/lib/crunchrun/crunchrun_test.go +++ b/lib/crunchrun/crunchrun_test.go @@ -112,16 +112,17 @@ type stubExecutor struct { exit chan int } -func (e *stubExecutor) ImageLoaded(imageID string) bool { return e.imageLoaded } -func (e *stubExecutor) LoadImage(filename string) error { e.loaded = filename; return e.loadErr } +func (e *stubExecutor) LoadImage(imageId string, tarball string, container arvados.Container, keepMount string, + containerClient *arvados.Client) error { + e.loaded = tarball + return e.loadErr +} func (e *stubExecutor) Create(spec containerSpec) error { e.created = spec; return e.createErr } func (e *stubExecutor) Start() error { e.exit = make(chan int, 1); go e.runFunc(); return e.startErr } func (e *stubExecutor) CgroupID() string { return "cgroupid" } func (e *stubExecutor) Stop() error { e.stopped = true; go func() { e.exit <- -1 }(); return e.stopErr } func (e *stubExecutor) Close() { e.closed = true } func (e *stubExecutor) Wait(context.Context) (int, error) { - defer e.created.Stdout.Close() - defer e.created.Stderr.Close() return <-e.exit, e.waitErr } @@ -307,9 +308,11 @@ func (client *KeepTestClient) LocalLocator(locator string) (string, error) { return locator, nil } -func (client *KeepTestClient) PutB(buf []byte) (string, int, error) { - client.Content = buf - return fmt.Sprintf("%x+%d", md5.Sum(buf), len(buf)), len(buf), nil +func (client *KeepTestClient) BlockWrite(_ context.Context, opts arvados.BlockWriteOptions) (arvados.BlockWriteResponse, error) { + client.Content = opts.Data + return arvados.BlockWriteResponse{ + Locator: fmt.Sprintf("%x+%d", md5.Sum(opts.Data), len(opts.Data)), + }, nil } func (client *KeepTestClient) ReadAt(string, []byte, int) (int, error) { @@ -455,8 +458,8 @@ func (*KeepErrorTestClient) ManifestFileReader(manifest.Manifest, string) (arvad return nil, errors.New("KeepError") } -func (*KeepErrorTestClient) PutB(buf []byte) (string, int, error) { - return "", 0, errors.New("KeepError") +func (*KeepErrorTestClient) BlockWrite(context.Context, arvados.BlockWriteOptions) (arvados.BlockWriteResponse, error) { + return arvados.BlockWriteResponse{}, errors.New("KeepError") } func (*KeepErrorTestClient) LocalLocator(string) (string, error) { @@ -522,8 +525,6 @@ func dockerLog(fd byte, msg string) []byte { func (s *TestSuite) TestRunContainer(c *C) { s.executor.runFunc = func() { fmt.Fprintf(s.executor.created.Stdout, "Hello world\n") - s.executor.created.Stdout.Close() - s.executor.created.Stderr.Close() s.executor.exit <- 0 }