}
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())
}
}
"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
// 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)
// 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)
// 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 {
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
}
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) {
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)
}
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) {
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()
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")
}