mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
stop explicitly recalculating caches in tests
This is no longer necessary, as caches now recalculate on read. Also, in general a user will not explicitly request recalculation, so it would make sense for our tests to reflect that.
This commit is contained in:
parent
f026c43649
commit
79f68f7a2e
5 changed files with 4 additions and 19 deletions
3
api.go
3
api.go
|
|
@ -780,7 +780,8 @@ func (api *API) Node() *Node {
|
|||
return &node
|
||||
}
|
||||
|
||||
// RecalculateCaches forces all TopN caches to be updated. Used mainly for integration tests.
|
||||
// RecalculateCaches forces all TopN caches to be updated.
|
||||
// This is done internally within a TopN query, but a user may want to do it ahead of time?
|
||||
func (api *API) RecalculateCaches(ctx context.Context) error {
|
||||
span, _ := tracing.StartSpanFromContext(ctx, "API.RecalculateCaches")
|
||||
defer span.Finish()
|
||||
|
|
|
|||
|
|
@ -2943,10 +2943,6 @@ func TestExecutor_Execute_Remote_Row(t *testing.T) {
|
|||
`}); err != nil {
|
||||
t.Fatalf("querying remote: %v", err)
|
||||
}
|
||||
err := c.GetNode(0).API.RecalculateCaches(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("recalculating caches: %v", err)
|
||||
}
|
||||
|
||||
if res, err := c.GetNode(1).API.Query(context.Background(), &pilosa.QueryRequest{
|
||||
Index: "i",
|
||||
|
|
|
|||
|
|
@ -1154,6 +1154,8 @@ func (h *Holder) flushCaches() {
|
|||
// probably not practical to call in real-world workloads, but makes writing
|
||||
// integration tests much eaiser, since one doesn't have to wait 10 seconds
|
||||
// after setting bits to get expected response.
|
||||
// This is mostly unnecessary now, as caches will automatically recalculate on read.
|
||||
// However, a user may explicitly request calculation, in which case we should not defer it.
|
||||
func (h *Holder) recalculateCaches() {
|
||||
for _, index := range h.Indexes() {
|
||||
index.recalculateCaches()
|
||||
|
|
|
|||
|
|
@ -617,7 +617,6 @@ func TestClient_ImportKeys(t *testing.T) {
|
|||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cmd.MustRecalculateCaches(t)
|
||||
resp := cmd.QueryAPI(t, &pilosa.QueryRequest{
|
||||
Index: "keyed",
|
||||
Query: "TopN(keyedf)",
|
||||
|
|
@ -644,7 +643,6 @@ func TestClient_ImportKeys(t *testing.T) {
|
|||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cmd.MustRecalculateCaches(t)
|
||||
resp := cmd.QueryAPI(t, &pilosa.QueryRequest{
|
||||
Index: "keyed",
|
||||
Query: "TopN(unkeyedf)",
|
||||
|
|
@ -671,7 +669,6 @@ func TestClient_ImportKeys(t *testing.T) {
|
|||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cmd.MustRecalculateCaches(t)
|
||||
resp := cmd.QueryAPI(t, &pilosa.QueryRequest{
|
||||
Index: "unkeyed",
|
||||
Query: "TopN(keyedf)",
|
||||
|
|
@ -716,7 +713,6 @@ func TestClient_ImportKeys(t *testing.T) {
|
|||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cmd0.MustRecalculateCaches(t)
|
||||
resp := cmd0.QueryAPI(t, &pilosa.QueryRequest{
|
||||
Index: "keyed",
|
||||
Query: "TopN(keyedf0)",
|
||||
|
|
@ -748,7 +744,6 @@ func TestClient_ImportKeys(t *testing.T) {
|
|||
// Wait for translation replication.
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
cmd1.MustRecalculateCaches(t)
|
||||
resp := cmd1.QueryAPI(t, &pilosa.QueryRequest{
|
||||
Index: "keyed",
|
||||
Query: "TopN(keyedf1)",
|
||||
|
|
|
|||
|
|
@ -184,15 +184,6 @@ func (m *Command) QueryAPI(tb testing.TB, req *pilosa.QueryRequest) pilosa.Query
|
|||
return resp
|
||||
}
|
||||
|
||||
// MustRecalculateCaches calls RecalculateCaches on the command's API, and fails
|
||||
// if there is an error.
|
||||
func (m *Command) MustRecalculateCaches(tb testing.TB) {
|
||||
err := m.API.RecalculateCaches(context.Background())
|
||||
if err != nil {
|
||||
tb.Fatalf("recalcluating caches: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// URL returns the base URL string for accessing the running program.
|
||||
func (m *Command) URL() string { return m.API.Node().URI.String() }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue