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

Unified Diff: appengine/logdog/coordinator/endpoints/services/terminateStream_test.go

Issue 1971493003: LogDog: Project READ access for user endpoints. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-service-config
Patch Set: Added project archival parametrs, better support. Created 4 years, 7 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: appengine/logdog/coordinator/endpoints/services/terminateStream_test.go
diff --git a/appengine/logdog/coordinator/endpoints/services/terminateStream_test.go b/appengine/logdog/coordinator/endpoints/services/terminateStream_test.go
index 25895b39dab0190bc3f984b8c275cf312cfe9a07..6c532654d61d67711b86a5553369fb843c502ae6 100644
--- a/appengine/logdog/coordinator/endpoints/services/terminateStream_test.go
+++ b/appengine/logdog/coordinator/endpoints/services/terminateStream_test.go
@@ -30,11 +30,16 @@ func TestTerminateStream(t *testing.T) {
Convey(`With a testing configuration`, t, func() {
c, env := ct.Install()
+ // Set our archival delays. The project delay is smaller than the service
+ // delay, so it should be used.
env.ModServiceConfig(c, func(cfg *svcconfig.Coordinator) {
cfg.ArchiveTopic = "projects/test/topics/archive"
cfg.ArchiveSettleDelay = google.NewDuration(10 * time.Second)
cfg.ArchiveDelayMax = google.NewDuration(24 * time.Hour)
})
+ env.ModProjectConfig("proj-foo", func(pcfg *svcconfig.ProjectConfig) {
+ pcfg.MaxStreamAge = google.NewDuration(time.Hour)
+ })
svr := New()
@@ -93,7 +98,7 @@ func TestTerminateStream(t *testing.T) {
// the future.
for _, t := range env.ArchivalPublisher.Tasks() {
So(t.SettleDelay.Duration(), ShouldEqual, 10*time.Second)
- So(t.CompletePeriod.Duration(), ShouldEqual, 24*time.Hour)
+ So(t.CompletePeriod.Duration(), ShouldEqual, time.Hour)
}
Convey(`Will cancel the expiration archive Tumble task.`, func() {
@@ -149,6 +154,38 @@ func TestTerminateStream(t *testing.T) {
})
})
+ Convey(`Will schedule the correct archival delay`, func() {
+
+ Convey(`When there is no project config delay.`, func() {
+ env.ModProjectConfig("proj-foo", func(pcfg *svcconfig.ProjectConfig) {
+ pcfg.MaxStreamAge = nil
+ })
+
+ _, err := svr.TerminateStream(c, &req)
+ So(err, ShouldBeRPCOK)
+
+ So(env.ArchivalPublisher.Hashes(), ShouldResemble, []string{string(tls.Stream.ID)})
+ So(len(env.ArchivalPublisher.Tasks()), ShouldEqual, 1)
+ So(env.ArchivalPublisher.Tasks()[0].CompletePeriod.Duration(), ShouldEqual, 24*time.Hour)
+ })
+
+ Convey(`When there is no service or project config delay.`, func() {
+ env.ModServiceConfig(c, func(cfg *svcconfig.Coordinator) {
+ cfg.ArchiveDelayMax = nil
+ })
+ env.ModProjectConfig("proj-foo", func(pcfg *svcconfig.ProjectConfig) {
+ pcfg.MaxStreamAge = nil
+ })
+
+ _, err := svr.TerminateStream(c, &req)
+ So(err, ShouldBeRPCOK)
+
+ So(env.ArchivalPublisher.Hashes(), ShouldResemble, []string{string(tls.Stream.ID)})
+ So(len(env.ArchivalPublisher.Tasks()), ShouldEqual, 1)
+ So(env.ArchivalPublisher.Tasks()[0].CompletePeriod.Duration(), ShouldEqual, 0)
+ })
+ })
+
Convey(`Will return an internal server error if Put() fails.`, func() {
c, fb := featureBreaker.FilterRDS(c, nil)
fb.BreakFeatures(errors.New("test error"), "PutMulti")

Powered by Google App Engine
This is Rietveld 408576698