mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:12:02 +00:00
searcher: fix benchmarks (#64292)
Column helper now returns 0 based indexes. FilterTar became a required function on diskcache. Test Plan: go test -run '^$' -bench . ./cmd/searcher/internal/search Fixes https://linear.app/sourcegraph/issue/SPLF-183/benchmarks-in-searcher-broken
This commit is contained in:
parent
155975259a
commit
c09552ed15
@ -370,8 +370,8 @@ func BenchmarkColumnHelper(b *testing.B) {
|
||||
offset := 0
|
||||
for offset < len(data) {
|
||||
col := columnHelper.get(lineOffset, offset)
|
||||
if col != offset+1 {
|
||||
b.Fatal("column is not offset even though data is ASCII")
|
||||
if col != offset {
|
||||
b.Fatal("column is not offset even though data is ASCII", col, offset)
|
||||
}
|
||||
offset += dist
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package search
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"context"
|
||||
@ -463,6 +464,7 @@ func TestPathMatches(t *testing.T) {
|
||||
// githubStore fetches from github and caches across test runs.
|
||||
var githubStore = &Store{
|
||||
FetchTar: fetchTarFromGithub,
|
||||
FilterTar: noFilterTar,
|
||||
Path: "/tmp/search_test/store",
|
||||
Logger: observation.TestContext.Logger,
|
||||
ObservationCtx: &observation.TestContext,
|
||||
@ -473,6 +475,10 @@ func fetchTarFromGithub(ctx context.Context, repo api.RepoName, commit api.Commi
|
||||
return r, err
|
||||
}
|
||||
|
||||
func noFilterTar(ctx context.Context, repo api.RepoName, commit api.CommitID) (FilterFunc, error) {
|
||||
return func(hdr *tar.Header) bool { return false }, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Clear out store so we pick up changes in our store writing code.
|
||||
os.RemoveAll(githubStore.Path)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user