From 0568e6de6a234ea25a3654ac4a68ad4b45a99ba9 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 19 Jan 2016 16:43:54 -0500 Subject: [PATCH] 7816: Rename to crunch-run --- sdk/go/manifest/manifest_test.go | 9 ++------- .../crunchexec.go => crunch-run/crunchrun.go} | 10 +++++----- .../crunchrun_test.go} | 4 ++-- services/{crunch-exec => crunch-run}/logging.go | 0 services/{crunch-exec => crunch-run}/logging_test.go | 10 +++++----- services/{crunch-exec => crunch-run}/upload.go | 0 6 files changed, 14 insertions(+), 19 deletions(-) rename services/{crunch-exec/crunchexec.go => crunch-run/crunchrun.go} (98%) rename services/{crunch-exec/crunchexec_test.go => crunch-run/crunchrun_test.go} (99%) rename services/{crunch-exec => crunch-run}/logging.go (100%) rename services/{crunch-exec => crunch-run}/logging_test.go (90%) rename services/{crunch-exec => crunch-run}/upload.go (100%) diff --git a/sdk/go/manifest/manifest_test.go b/sdk/go/manifest/manifest_test.go index f52d5644a2..2fe427224e 100644 --- a/sdk/go/manifest/manifest_test.go +++ b/sdk/go/manifest/manifest_test.go @@ -62,13 +62,8 @@ func expectStringSlicesEqual(t *testing.T, actual []string, expected []string) { } func expectFileStreamSegmentsEqual(t *testing.T, actual []FileStreamSegment, expected []FileStreamSegment) { - if len(actual) != len(expected) { - t.Fatalf("Expected %v (length %d), but received %v (length %d) instead. %s", expected, len(expected), actual, len(actual), getStackTrace()) - } - for i := range actual { - if actual[i] != expected[i] { - t.Fatalf("Expected %v but received %v instead (first disagreement at position %d). %s", expected, actual, i, getStackTrace()) - } + if !reflect.DeepEqual(actual, expected) { + t.Fatalf("Expected %v but received %v instead. %s", expected, actual, getStackTrace()) } } diff --git a/services/crunch-exec/crunchexec.go b/services/crunch-run/crunchrun.go similarity index 98% rename from services/crunch-exec/crunchexec.go rename to services/crunch-run/crunchrun.go index c07ce4a627..fd91bc1e71 100644 --- a/services/crunch-exec/crunchexec.go +++ b/services/crunch-run/crunchrun.go @@ -16,7 +16,7 @@ import ( "syscall" ) -// IArvadosClient is the minimal Arvados API methods used by crunchexec. +// IArvadosClient is the minimal Arvados API methods used by crunch-run. type IArvadosClient interface { Create(resourceType string, parameters arvadosclient.Dict, output interface{}) error Get(resourceType string, uuid string, parameters arvadosclient.Dict, output interface{}) error @@ -26,7 +26,7 @@ type IArvadosClient interface { // ErrCancelled is the error returned when the container is cancelled. var ErrCancelled = errors.New("Cancelled") -// IKeepClient is the minimal Keep API methods used by crunchexec. +// IKeepClient is the minimal Keep API methods used by crunch-run. type IKeepClient interface { PutHB(hash string, buf []byte) (string, int, error) ManifestFileReader(m manifest.Manifest, filename string) (keepclient.ReadCloserWithLen, error) @@ -57,7 +57,7 @@ type ContainerRecord struct { // NewLogWriter is a factory function to create a new log writer. type NewLogWriter func(name string) io.WriteCloser -// ThinDockerClient is the minimal Docker client interface used by crunchexec. +// ThinDockerClient is the minimal Docker client interface used by crunch-run. type ThinDockerClient interface { StopContainer(id string, timeout int) error InspectImage(id string) (*dockerclient.ImageInfo, error) @@ -252,7 +252,7 @@ func (runner *ContainerRunner) CommitLogs() error { // other further (such as failing to write the log to Keep!) while // shutting down runner.CrunchLog = NewThrottledLogger(&ArvLogWriter{runner.ArvClient, runner.ContainerRecord.UUID, - "crunchexec", nil}) + "crunch-run", nil}) mt, err := runner.LogCollection.ManifestText() if err != nil { @@ -397,7 +397,7 @@ func NewContainerRunner(api IArvadosClient, cr := &ContainerRunner{ArvClient: api, Kc: kc, Docker: docker} cr.NewLogWriter = cr.NewArvLogWriter cr.LogCollection = &CollectionWriter{kc, nil} - cr.CrunchLog = NewThrottledLogger(cr.NewLogWriter("crunchexec")) + cr.CrunchLog = NewThrottledLogger(cr.NewLogWriter("crunch-run")) return cr } diff --git a/services/crunch-exec/crunchexec_test.go b/services/crunch-run/crunchrun_test.go similarity index 99% rename from services/crunch-exec/crunchexec_test.go rename to services/crunch-run/crunchrun_test.go index baf67b2769..1946e5c403 100644 --- a/services/crunch-exec/crunchexec_test.go +++ b/services/crunch-run/crunchrun_test.go @@ -401,8 +401,8 @@ func (s *TestSuite) TestCommitLogs(c *C) { c.Check(err, IsNil) c.Check(api.Content["name"], Equals, "logs for zzzzz-zzzzz-zzzzzzzzzzzzzzz") - c.Check(api.Content["manifest_text"], Equals, ". 744b2e4553123b02fa7b452ec5c18993+123 0:123:crunchexec.txt\n") - c.Check(*cr.LogsPDH, Equals, "d3a229d2fe3690c2c3e75a71a153c6a3+60") + c.Check(api.Content["manifest_text"], Equals, ". 744b2e4553123b02fa7b452ec5c18993+123 0:123:crunch-run.txt\n") + c.Check(*cr.LogsPDH, Equals, "63da7bdacf08c40f604daad80c261e9a+60") } func (s *TestSuite) TestUpdateContainerRecordRunning(c *C) { diff --git a/services/crunch-exec/logging.go b/services/crunch-run/logging.go similarity index 100% rename from services/crunch-exec/logging.go rename to services/crunch-run/logging.go diff --git a/services/crunch-exec/logging_test.go b/services/crunch-run/logging_test.go similarity index 90% rename from services/crunch-exec/logging_test.go rename to services/crunch-run/logging_test.go index fd51936ba1..d8fdaa3165 100644 --- a/services/crunch-exec/logging_test.go +++ b/services/crunch-run/logging_test.go @@ -34,12 +34,12 @@ func (s *LoggingTestSuite) TestWriteLogs(c *C) { mt, err := cr.LogCollection.ManifestText() c.Check(err, IsNil) - c.Check(mt, Equals, ". 74561df9ae65ee9f35d5661d42454264+83 0:83:crunchexec.txt\n") + c.Check(mt, Equals, ". 74561df9ae65ee9f35d5661d42454264+83 0:83:crunch-run.txt\n") logtext := "2015-12-29T15:51:45.000000001Z Hello world!\n" + "2015-12-29T15:51:45.000000002Z Goodbye\n" - c.Check(api.Content["event_type"], Equals, "crunchexec") + c.Check(api.Content["event_type"], Equals, "crunch-run") c.Check(api.Content["properties"].(map[string]string)["text"], Equals, logtext) c.Check(string(kc.Content), Equals, logtext) } @@ -61,7 +61,7 @@ func (s *LoggingTestSuite) TestWriteLogsLarge(c *C) { mt, err := cr.LogCollection.ManifestText() c.Check(err, IsNil) - c.Check(mt, Equals, ". 9c2c05d1fae6aaa8af85113ba725716d+67108864 80b821383a07266c2a66a4566835e26e+21780065 0:88888929:crunchexec.txt\n") + c.Check(mt, Equals, ". 9c2c05d1fae6aaa8af85113ba725716d+67108864 80b821383a07266c2a66a4566835e26e+21780065 0:88888929:crunch-run.txt\n") } func (s *LoggingTestSuite) TestWriteMultipleLogs(c *C) { @@ -81,7 +81,7 @@ func (s *LoggingTestSuite) TestWriteMultipleLogs(c *C) { cr.CrunchLog.Close() logtext1 := "2015-12-29T15:51:45.000000001Z Hello world!\n" + "2015-12-29T15:51:45.000000003Z Goodbye\n" - c.Check(api.Content["event_type"], Equals, "crunchexec") + c.Check(api.Content["event_type"], Equals, "crunch-run") c.Check(api.Content["properties"].(map[string]string)["text"], Equals, logtext1) stdout.Close() @@ -93,6 +93,6 @@ func (s *LoggingTestSuite) TestWriteMultipleLogs(c *C) { mt, err := cr.LogCollection.ManifestText() c.Check(err, IsNil) c.Check(mt, Equals, ""+ - ". 408672f5b5325f7d20edfbf899faee42+83 0:83:crunchexec.txt\n"+ + ". 408672f5b5325f7d20edfbf899faee42+83 0:83:crunch-run.txt\n"+ ". c556a293010069fa79a6790a931531d5+80 0:80:stdout.txt\n") } diff --git a/services/crunch-exec/upload.go b/services/crunch-run/upload.go similarity index 100% rename from services/crunch-exec/upload.go rename to services/crunch-run/upload.go -- 2.30.2