Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: server/internal/logdog/archivist/archivist_test.go

Issue 1853433002: LogDog: Handle archive failures. (Closed) Base URL: https://github.com/luci/luci-go@logdog-gs-update
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: server/internal/logdog/archivist/archivist_test.go
diff --git a/server/internal/logdog/archivist/archivist_test.go b/server/internal/logdog/archivist/archivist_test.go
index 12daac169e7ca7d70f8181b69d077782b5ac5e8d..93ac551aecac06bad15dde1f261acb242e2f068c 100644
--- a/server/internal/logdog/archivist/archivist_test.go
+++ b/server/internal/logdog/archivist/archivist_test.go
@@ -225,13 +225,14 @@ func TestHandleArchive(t *testing.T) {
}
var archiveRequest *logdog.ArchiveStreamRequest
+ var archiveStreamErr error
sc := testServicesClient{
lsCallback: func(req *logdog.LoadStreamRequest) (*logdog.LoadStreamResponse, error) {
return &stream, nil
},
asCallback: func(req *logdog.ArchiveStreamRequest) error {
archiveRequest = req
- return nil
+ return archiveStreamErr
},
}
@@ -371,6 +372,19 @@ func TestHandleArchive(t *testing.T) {
DataUrl: gsURL("data.bin"),
})
})
+
+ Convey(`When an archival error occurs, will submit an ArchiveStreamRequest with Error set.`, func() {
+ gsc.newWriterErr = func(*testGSWriter) error { return errors.New("test error") }
+ archiveStreamErr = errors.New("test error")
+
+ So(ar.Archive(c, &task), ShouldEqual, archiveStreamErr)
+ So(archiveRequest, ShouldResemble, &logdog.ArchiveStreamRequest{
+ Path: task.Path,
+ Complete: false,
+ TerminalIndex: -1,
+ Error: true,
+ })
+ })
})
Convey(`With terminal index 3`, func() {
@@ -483,9 +497,10 @@ func TestHandleArchive(t *testing.T) {
}
}},
} {
- Convey(fmt.Sprintf(`Can handle %s for %s`, testCase.name, failName), func() {
+ Convey(fmt.Sprintf(`Can handle %s for %s, and will not archive.`, testCase.name, failName), func() {
testCase.setup()
So(ar.Archive(c, &task), ShouldErrLike, "test error")
+ So(archiveRequest, ShouldBeNil)
})
}
}

Powered by Google App Engine
This is Rietveld 408576698