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

Side by Side Diff: appengine/cmd/cron/engine/engine_test.go

Issue 1910633006: LogDog: Support per-namespace expired archival. (Closed) Base URL: https://github.com/luci/luci-go@logdog-coordinator-svcdec
Patch Set: Update another test. 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 unified diff | Download patch
« no previous file with comments | « no previous file | appengine/cmd/logdog_coordinator/backend/main.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package engine 5 package engine
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "math/rand" 9 "math/rand"
10 "sort" 10 "sort"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 612
613 func TestPrepareTopic(t *testing.T) { 613 func TestPrepareTopic(t *testing.T) {
614 Convey("PrepareTopic works", t, func(ctx C) { 614 Convey("PrepareTopic works", t, func(ctx C) {
615 c := newTestContext(epoch) 615 c := newTestContext(epoch)
616 616
617 e, _ := newTestEngine() 617 e, _ := newTestEngine()
618 618
619 pubSubCalls := 0 619 pubSubCalls := 0
620 e.configureTopic = func(c context.Context, topic, sub, pushURL, publisher string) error { 620 e.configureTopic = func(c context.Context, topic, sub, pushURL, publisher string) error {
621 pubSubCalls++ 621 pubSubCalls++
622 » » » ctx.So(topic, ShouldEqual, "projects/dev~app/topics/dev- cron+noop+some~publisher.com") 622 » » » ctx.So(topic, ShouldEqual, "projects/app/topics/dev-cron +noop+some~publisher.com")
623 » » » ctx.So(sub, ShouldEqual, "projects/dev~app/subscriptions /dev-cron+noop+some~publisher.com") 623 » » » ctx.So(sub, ShouldEqual, "projects/app/subscriptions/dev -cron+noop+some~publisher.com")
624 ctx.So(pushURL, ShouldEqual, "") // pull on dev server 624 ctx.So(pushURL, ShouldEqual, "") // pull on dev server
625 ctx.So(publisher, ShouldEqual, "some@publisher.com") 625 ctx.So(publisher, ShouldEqual, "some@publisher.com")
626 return nil 626 return nil
627 } 627 }
628 628
629 ctl := &taskController{ 629 ctl := &taskController{
630 ctx: c, 630 ctx: c,
631 eng: e, 631 eng: e,
632 manager: &noop.TaskManager{}, 632 manager: &noop.TaskManager{},
633 saved: Invocation{ 633 saved: Invocation{
634 ID: 123456, 634 ID: 123456,
635 JobKey: datastore.Get(c).NewKey("CronJob", "job_ id", 0, nil), 635 JobKey: datastore.Get(c).NewKey("CronJob", "job_ id", 0, nil),
636 }, 636 },
637 } 637 }
638 ctl.populateState() 638 ctl.populateState()
639 639
640 // Once. 640 // Once.
641 topic, token, err := ctl.PrepareTopic("some@publisher.com") 641 topic, token, err := ctl.PrepareTopic("some@publisher.com")
642 So(err, ShouldBeNil) 642 So(err, ShouldBeNil)
643 » » So(topic, ShouldEqual, "projects/dev~app/topics/dev-cron+noop+so me~publisher.com") 643 » » So(topic, ShouldEqual, "projects/app/topics/dev-cron+noop+some~p ublisher.com")
644 So(token, ShouldNotEqual, "") 644 So(token, ShouldNotEqual, "")
645 So(pubSubCalls, ShouldEqual, 1) 645 So(pubSubCalls, ShouldEqual, 1)
646 646
647 // Again. 'configureTopic' should not be called anymore. 647 // Again. 'configureTopic' should not be called anymore.
648 _, _, err = ctl.PrepareTopic("some@publisher.com") 648 _, _, err = ctl.PrepareTopic("some@publisher.com")
649 So(err, ShouldBeNil) 649 So(err, ShouldBeNil)
650 So(pubSubCalls, ShouldEqual, 1) 650 So(pubSubCalls, ShouldEqual, 1)
651 651
652 // Make sure memcache-based deduplication also works. 652 // Make sure memcache-based deduplication also works.
653 e.doneFlags = make(map[string]bool) 653 e.doneFlags = make(map[string]bool)
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 911
912 func ensureOneTask(c context.Context, q string) *taskqueue.Task { 912 func ensureOneTask(c context.Context, q string) *taskqueue.Task {
913 tqt := taskqueue.Get(c).Testable() 913 tqt := taskqueue.Get(c).Testable()
914 tasks := tqt.GetScheduledTasks()[q] 914 tasks := tqt.GetScheduledTasks()[q]
915 So(len(tasks), ShouldEqual, 1) 915 So(len(tasks), ShouldEqual, 1)
916 for _, t := range tasks { 916 for _, t := range tasks {
917 return t 917 return t
918 } 918 }
919 return nil 919 return nil
920 } 920 }
OLDNEW
« no previous file with comments | « no previous file | appengine/cmd/logdog_coordinator/backend/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698