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

Side by Side Diff: client/cmd/isolate/checker_test.go

Issue 2570433002: client/isolate: correctly propagate context.Context (Closed)
Patch Set: diff from other CL Created 4 years 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 | « client/cmd/isolate/checker.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 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 "sync" 10 "sync"
(...skipping 18 matching lines...) Expand all
29 itemBatches [][]*service.HandlersEndpointsV1Digest 29 itemBatches [][]*service.HandlersEndpointsV1Digest
30 30
31 // batchc is a channel on which incoming batches are sent (before proces sing) 31 // batchc is a channel on which incoming batches are sent (before proces sing)
32 // if non-nil. 32 // if non-nil.
33 batchc chan<- []*service.HandlersEndpointsV1Digest 33 batchc chan<- []*service.HandlersEndpointsV1Digest
34 34
35 // errc is a channel from which errors are pulled, if non-nil. 35 // errc is a channel from which errors are pulled, if non-nil.
36 errc <-chan error 36 errc <-chan error
37 } 37 }
38 38
39 func (f *fakeIsolateService) Contains(_ context.Context, digests []*service.Hand lersEndpointsV1Digest) ([]*isolatedclient.PushState, error) { 39 func (f *fakeIsolateService) Contains(ctx context.Context, digests []*service.Ha ndlersEndpointsV1Digest) ([]*isolatedclient.PushState, error) {
40 » select {
41 » case <-ctx.Done():
42 » » return nil, ctx.Err()
43 » default:
44 » }
40 f.mu.Lock() 45 f.mu.Lock()
41 defer f.mu.Unlock() 46 defer f.mu.Unlock()
42 var states []*isolatedclient.PushState 47 var states []*isolatedclient.PushState
43 f.itemBatches = append(f.itemBatches, digests) 48 f.itemBatches = append(f.itemBatches, digests)
44 if f.batchc != nil { 49 if f.batchc != nil {
45 f.batchc <- digests 50 f.batchc <- digests
46 } 51 }
47 if f.pushStates == nil { 52 if f.pushStates == nil {
48 f.pushStates = make(map[string]*isolatedclient.PushState) 53 f.pushStates = make(map[string]*isolatedclient.PushState)
49 } 54 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 Path: fmt.Sprintf("/item/%d", i), 158 Path: fmt.Sprintf("/item/%d", i),
154 Digest: isolated.HexDigest(fmt.Sprintf("digest%d", i)), 159 Digest: isolated.HexDigest(fmt.Sprintf("digest%d", i)),
155 } 160 }
156 checker.AddItem(item, false, nop) 161 checker.AddItem(item, false, nop)
157 } 162 }
158 163
159 if err := checker.Close(); err != errBang { 164 if err := checker.Close(); err != errBang {
160 t.Fatalf("checker.Close: got error %v; want %v", err, errBang) 165 t.Fatalf("checker.Close: got error %v; want %v", err, errBang)
161 } 166 }
162 } 167 }
OLDNEW
« no previous file with comments | « client/cmd/isolate/checker.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698