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

Side by Side Diff: go/src/infra/monitoring/dispatcher/loop_test.go

Issue 1223213002: Remove libs/clock in favor of luci-go/common/clock. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@abstract
Patch Set: rebase Created 5 years, 5 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 | « go/src/infra/monitoring/dispatcher/dispatcher.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package main 1 package main
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "testing" 5 "testing"
6 "time" 6 "time"
7 7
8 "github.com/luci/luci-go/common/clock"
9 "github.com/luci/luci-go/common/clock/testclock"
8 "golang.org/x/net/context" 10 "golang.org/x/net/context"
9 "infra/libs/clock"
10 "infra/libs/clock/testclock"
11 ) 11 )
12 12
13 // Should run f at least once, even if the duration is 0. 13 // Should run f at least once, even if the duration is 0.
14 func TestLoopOnce(t *testing.T) { 14 func TestLoopOnce(t *testing.T) {
15 _, c := testclock.UseTime(context.Background(), time.Unix(0, 0)) 15 _, c := testclock.UseTime(context.Background(), time.Unix(0, 0))
16 16
17 nCalls := 0 17 nCalls := 0
18 f := func() error { 18 f := func() error {
19 log.Infof("tick") 19 log.Infof("tick")
20 nCalls++ 20 nCalls++
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 // Now read off the rest of the timer ticks. 224 // Now read off the rest of the timer ticks.
225 for i := 0; i < 7; i++ { 225 for i := 0; i < 7; i++ {
226 <-timerStartedC 226 <-timerStartedC
227 c.Add(1 * time.Second) 227 c.Add(1 * time.Second)
228 } 228 }
229 229
230 c.Add(1 * time.Second) 230 c.Add(1 * time.Second)
231 <-done 231 <-done
232 } 232 }
OLDNEW
« no previous file with comments | « go/src/infra/monitoring/dispatcher/dispatcher.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698