7816: Rename to crunch-run
authorPeter Amstutz <peter.amstutz@curoverse.com>
Tue, 19 Jan 2016 21:43:54 +0000 (16:43 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Tue, 19 Jan 2016 21:43:54 +0000 (16:43 -0500)
sdk/go/manifest/manifest_test.go
services/crunch-run/crunchrun.go [moved from services/crunch-exec/crunchexec.go with 98% similarity]
services/crunch-run/crunchrun_test.go [moved from services/crunch-exec/crunchexec_test.go with 99% similarity]
services/crunch-run/logging.go [moved from services/crunch-exec/logging.go with 100% similarity]
services/crunch-run/logging_test.go [moved from services/crunch-exec/logging_test.go with 90% similarity]
services/crunch-run/upload.go [moved from services/crunch-exec/upload.go with 100% similarity]

index f52d5644a23d7ed79242f4d3685362dac13f4a22..2fe427224ec848ea448a172aaf9e991289b46dd3 100644 (file)
@@ -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())
        }
 }
 
similarity index 98%
rename from services/crunch-exec/crunchexec.go
rename to services/crunch-run/crunchrun.go
index c07ce4a62705ec66ba2ccdd76842a7a433f8818d..fd91bc1e7182eff0fecbc33da93cd9994c50f3e7 100644 (file)
@@ -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
 }
 
similarity index 99%
rename from services/crunch-exec/crunchexec_test.go
rename to services/crunch-run/crunchrun_test.go
index baf67b27691683641e6514837b13392a2b7b28df..1946e5c403e02756f18589bc9a37a8333e2ca7a4 100644 (file)
@@ -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) {
similarity index 90%
rename from services/crunch-exec/logging_test.go
rename to services/crunch-run/logging_test.go
index fd51936ba123b53507e75483b0daf8e825f4c00f..d8fdaa31650c3e5b51930bfdb32d520cb89b86b5 100644 (file)
@@ -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")
 }