From 2ee589ae1d1448dae283f0fcf767477630bc7461 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 24 Feb 2021 10:40:59 -0600 Subject: [PATCH] reduce goroutine spam during TestVariousQueries etcd runs a LOT more goroutines during server startup. Fix a goroutine/for loop bug causing us to run four 7-node clusters instead of 1/3/4/7-node clusters, also have the test/cluster code reduce import workers. We can't do much about the spamminess of the Raft stuff, but this should tone it down some. --- executor_test.go | 17 +++++++---------- test/cluster.go | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/executor_test.go b/executor_test.go index 62752798c..10949c4ec 100644 --- a/executor_test.go +++ b/executor_test.go @@ -6848,20 +6848,20 @@ func TestMissingKeyRegression(t *testing.T) { // queries (HTTP, GRPC, Postgres), etc.). func TestVariousQueries(t *testing.T) { for _, clusterSize := range []int{1, 3, 4, 7} { + clusterSize := clusterSize t.Run(fmt.Sprintf("%d-node", clusterSize), func(t *testing.T) { t.Parallel() + c := test.MustRunCluster(t, clusterSize) + defer c.Close() - variousQueries(t, clusterSize) - variousQueriesOnTimeFields(t, clusterSize) + variousQueries(t, c) + variousQueriesOnTimeFields(t, c) }) } } // tests for abbreviating time values in queries -func variousQueriesOnTimeFields(t *testing.T, clusterSize int) { - c := test.MustRunCluster(t, clusterSize) - defer c.Close() - +func variousQueriesOnTimeFields(t *testing.T, c *test.Cluster) { ts := func(t time.Time) int64 { return t.Unix() * 1e+9 } @@ -6984,10 +6984,7 @@ func variousQueriesOnTimeFields(t *testing.T, clusterSize int) { } } -func variousQueries(t *testing.T, clusterSize int) { - c := test.MustRunCluster(t, clusterSize) - defer c.Close() - +func variousQueries(t *testing.T, c *test.Cluster) { // Create and populate "likenums" similar to "likes", but without keys on the field. c.CreateField(t, "users", pilosa.IndexOptions{Keys: true, TrackExistence: true}, "likenums") c.ImportIDKey(t, "users", "likenums", []test.KeyID{ diff --git a/test/cluster.go b/test/cluster.go index 4b8e55c5b..e1daaebaf 100644 --- a/test/cluster.go +++ b/test/cluster.go @@ -476,6 +476,7 @@ func newCluster(tb testing.TB, size int, opts ...[]server.CommandOption) (*Clust commandOpts = opts[i%len(opts)] } m := NewCommandNode(tb, commandOpts...) + m.Config.ImportWorkerPoolSize = 2 cluster.Nodes[i] = m }