OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |