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

Side by Side Diff: golden/go/mocks/mocks.go

Issue 1401563003: Enable clear/purge for failed digests (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Added unit test to FileDiffStore Created 5 years, 2 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 | « golden/go/filediffstore/filediffstore_test.go ('k') | golden/go/skiacorrectness/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 package mocks 1 package mocks
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "os" 5 "os"
6 "sort" 6 "sort"
7 "strings" 7 "strings"
8 "time" 8 "time"
9 9
10 assert "github.com/stretchr/testify/require" 10 assert "github.com/stretchr/testify/require"
(...skipping 29 matching lines...) Expand all
40 40
41 func (m MockDiffStore) AbsPath(digest []string) map[string]string { 41 func (m MockDiffStore) AbsPath(digest []string) map[string]string {
42 result := map[string]string{} 42 result := map[string]string{}
43 for _, d := range digest { 43 for _, d := range digest {
44 result[d] = "abspath/" + d 44 result[d] = "abspath/" + d
45 } 45 }
46 return result 46 return result
47 } 47 }
48 48
49 func (m MockDiffStore) UnavailableDigests() map[string]*diff.DigestFailure { return nil } 49 func (m MockDiffStore) UnavailableDigests() map[string]*diff.DigestFailure { return nil }
50 func (m MockDiffStore) PurgeDigests(digests []string, purgeGS bool) {} 50 func (m MockDiffStore) PurgeDigests(digests []string, purgeGS bool) error { return nil }
51 func (m MockDiffStore) SetDigestSets(namedDigestSets map[string]map[string]bool) {} 51 func (m MockDiffStore) SetDigestSets(namedDigestSets map[string]map[string]bool) {}
52 52
53 func NewMockDiffStore() diff.DiffStore { 53 func NewMockDiffStore() diff.DiffStore {
54 return MockDiffStore{} 54 return MockDiffStore{}
55 } 55 }
56 56
57 // Mock the tilestore for GoldenTraces 57 // Mock the tilestore for GoldenTraces
58 func NewMockTileStore(t assert.TestingT, digests [][]string, params []map[string ]string, commits []*tiling.Commit) tiling.TileStore { 58 func NewMockTileStore(t assert.TestingT, digests [][]string, params []map[string ]string, commits []*tiling.Commit) tiling.TileStore {
59 // Build the tile from the digests, params and commits. 59 // Build the tile from the digests, params and commits.
60 traces := map[string]tiling.Trace{} 60 traces := map[string]tiling.Trace{}
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // GetTileStoreFromEnv looks at the TEST_TILE_DIR environement variable for the 142 // GetTileStoreFromEnv looks at the TEST_TILE_DIR environement variable for the
143 // name of directory that contains tiles. If it's defined it will return a 143 // name of directory that contains tiles. If it's defined it will return a
144 // TileStore instance. If the not the calling test will fail. 144 // TileStore instance. If the not the calling test will fail.
145 func GetTileStoreFromEnv(t assert.TestingT) tiling.TileStore { 145 func GetTileStoreFromEnv(t assert.TestingT) tiling.TileStore {
146 // Get the TEST_TILE environment variable that points to the 146 // Get the TEST_TILE environment variable that points to the
147 // tile to read. 147 // tile to read.
148 tileDir := os.Getenv("TEST_TILE_DIR") 148 tileDir := os.Getenv("TEST_TILE_DIR")
149 assert.NotEqual(t, "", tileDir, "Please define the TEST_TILE_DIR environ ment variable to point to a live tile store.") 149 assert.NotEqual(t, "", tileDir, "Please define the TEST_TILE_DIR environ ment variable to point to a live tile store.")
150 return filetilestore.NewFileTileStore(tileDir, config.DATASET_GOLD, 2*ti me.Minute) 150 return filetilestore.NewFileTileStore(tileDir, config.DATASET_GOLD, 2*ti me.Minute)
151 } 151 }
OLDNEW
« no previous file with comments | « golden/go/filediffstore/filediffstore_test.go ('k') | golden/go/skiacorrectness/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698