Commit graph

37 commits

Author SHA1 Message Date
tgruben
dcdc99db25 enable staticcheck in ci; remove dead code (#2281)
(cherry picked from commit 0d6a92aeaf)
2022-11-15 11:33:12 -08:00
Seebs
ea69b0637d significant refactor of test setup and teardown
We centralize the creation paths for test indexes, fields,
etcetera so they all have a common path, all using standard
test holders. There's still two versions, one for test.* functions
and one for internal. They do share a TestHolderConfig though.

Large hunks of the related APIs are simplified/streamlined.
* Fragments are always created with a Field and don't need
  a workaround in case they don't have it.
* Creation of test fragments, etc., use optional FieldOptions
  but don't specify names because they're all using new holders
  for each thing created anyway. This dramatically reduces
  the complexity of the calls.
* test fragments are created inside test views which are created
  inside test fields, etcetera, so everything is using the same
  logic; test views aren't bypassing the other layers, they're
  creating themselves normally within a field.
* Quite a few things now use the standard runtime/production
  logic instead of being custom workarounds; for instance, instead
  of `mustOpenMutexFragment` creating a fragment and then creating
  a mutex vector for it, we just create a mutex-typed field and
  have the normal runtime code do this.
* Similarly, we now use the same field creation logic that production
  does, instead of having our own test-only thing that validates
  field names directly, so our test that we're validating field names
  is actually testing the runtime code. Yay.
* fragSpec goes away. it was a replacement for fragProxy which existed
  to solve memory allocation problems but replaced them with interface
  overhead problems. Now we just have pointers to things and maintain
  valid data structures.
* Many panics are now Fatal or Fatalf calls.
* Some specific bugs fixed, like a cluster which was requested and
  then had its first node directly overwritten, which isn't valid with
  shared clusters.
* Drop the temp-dir test flag and TempDir variable, we can just use
  $TMPDIR.
* Drop a benchmark of "write file to disk" that was purely a benchmark
  of file write speed, not a benchmark of rendering the data that needs
  to be written.
* Drop the unused "flags" parameter to fragment creation, which was
  only used back when we changed the BSI format.
* Use holder.Txf() rather than index.Txf(). The TxFactory has to be
  holder-level anyway, referring to it via the index is misleading.
* Test holders automatically close themselves and delete themselves,
  we remove various other things that thought they were responsible
  for deleting themselves.
2022-09-30 11:25:27 -07:00
Seebs
f6d17b1b58 refactor testing to share clusters more often
When doing tests, we create a ton of one-off clusters. This
turns out to be expensive and slow. Fixing it is surprisingly hard.

Fundamentally: If we're sharing clusters, we need to use different
indexes for each test, to avoid clashes. This changes index names.
As a side-effect, this reorders many partition-based things, like
the order keys are returned in. Thus, to fix this, we change a lot
of tests to no longer depend on the *order* in which strings are
returned.

Having done that, we can also discard the ModHasher behavior, since
that only existed to allow us to reliably predict partitioning.

The basic design is as follows: Instead of a cluster being a
[]*Command, a "shareable" cluster is now a []*Command plus some
flags, and a "cluster" is a pointer to a possibly-shared cluster,
plus a link to the specific test using this specific cluster,
and correspondingly, its test name suitably coerced to be a valid
index name prefix.

The "test.Cluster" object now has methods to allow retrieving an
index name, and also implemnts fmt.Formatter to let you use,
e.g., `%i` with it in Sprintf to get "the index name, plus an i".
(This works for everything but %p and %T.)

This allows us to consistently rework all the many things that
use index names in a persistent way.

We also have `MustUnshared` and `MustRunUnsharedCluster` methods
which allow us to specify that a given test needs its own cluster
for some reason. For instance, the tests that want to run backups
need their own isolated cluster, and the tests that want to close
or reopen nodes need their own cluster because a reopened cluster
won't have working GRPC for some reason.

On "closing" a shared cluster (actually the test-specific wrapper
that reflects a given sharing), we delete any indexes starting with
that test's index name prefix. Otherwise, the huge pile of open
indexes prevents `go test -race` from working on MacOS, where we
run out of address space too quickly.

This is fairly enormous but most of the individual changes are
fairly trivial things like replacing the string "i" with "c.Idx()".

We also tweaked a test that failed for me a couple of times to
not depend on sort order.
2022-09-30 11:10:47 -07:00
Seebs
fb3e60f88a set RBF sizes smaller for test
We end up hitting race detector limits on MacOS. This should mitigate
that.
2022-09-30 11:10:47 -07:00
Fletcher Haynes
da9b57bd45 Updated dependency paths to reflect new repo location 2022-09-06 09:39:22 -07:00
Fletcher Haynes
eb06bb50ae Updated code to latest version for open-sourcing. 2022-09-02 13:23:39 -07:00
Matt Jaffee
95547a9a27
remove the last usages of test.NewExecutor and cleanup unused in test package 2018-07-01 07:31:31 -05:00
Matt Jaffee
29ad1287d4
refactor executor_test.go 2018-06-30 08:41:19 -05:00
Matt Jaffee
5766f572b1
fix skipped client TopN test
had to remove the first check which was for the wrong result - because maxShard
is no longer wrong since the broadcaster is actually working.
2018-06-29 12:21:33 -05:00
Travis Turner
8021fc389b
un-export (some) Cluster methods 2018-06-13 15:42:35 -05:00
Travis Turner
2a9b1e9e5b
final Frame to Field rename 2018-06-06 01:27:12 -05:00
Travis Turner
4c44c5f33a
fix Frame to Field in tests 2018-06-05 23:33:00 -05:00
Travis Turner
9db359d34a
GoRename Frame to Field in holder.go 2018-06-05 22:36:19 -05:00
Travis Turner
3531c128c4
GoRename Frame to Field in index.go 2018-06-05 22:33:48 -05:00
Travis Turner
1d3c4d6fcb
first pass at GoRename Frame to Field in frame.go 2018-06-05 17:52:22 -05:00
Travis Turner
dd6b80f90d
rename fragment.SetFieldValue() to fragment.SetValue(). Still exported for tests 2018-06-04 15:08:49 -05:00
Travis Turner
90a4d957bd
remove frame argument from Frame.SetFieldValue(). Rename it to Frame.SetValue() 2018-06-04 15:08:48 -05:00
Travis Turner
0a8d573fb3
WIP: Remove SecurityManager. Implement api restrictions in api package. 2018-04-16 17:12:28 -05:00
Matthew Jaffee
04f5d5875c
api docs, rename funcs, refactor usage of internal
All exported funcs in api.go are now documented

Several poorly named methods of API and Cluster were renamed. Particularly, the
word Fragment was often changed to Slice in cases where it was really a slice
being specified and not a fragment.

several methods which received or returned internal data structures have been
refactored to be more opaque.

Deprecation logging was added to input definition methods.
2018-04-12 11:28:35 -05:00
Travis Turner
1cc45b22a2
Change Config.Coordinator from URI to bool 2018-03-08 12:42:24 -06:00
Travis Turner
1233226aa0
remove Join method from StaticMemberSet struct 2018-03-06 12:18:44 -06:00
Travis Turner
6776fa81ef
Merge branch 'master' into cluster-resize-merging 2018-02-16 11:13:40 -06:00
Travis Turner
668689e119
ensure that the license is prepended to all source files 2018-02-05 16:35:28 -06:00
Travis Turner
216ba7a41e
Use NodeID instead of URI for node identification 2018-02-02 15:58:46 -06:00
Travis Turner
0cb8b77640
fix potential race condition: reading from a nil channel 2018-01-23 16:32:32 -06:00
Travis Turner
f12527d535
put a mutex around Cluster.State 2018-01-23 16:00:32 -06:00
Travis Turner
5aa905b9a1
Merge pull request #935 from travisturner/cluster-resize-test-setvalue
add SetFieldValue() method to TestCluster and use in tests
2017-12-04 17:31:49 -06:00
Travis Turner
bd511dae80
ensure that holder opens before node is deemed ready 2017-11-27 11:06:03 -06:00
Travis Turner
212628b220
adjust tests to include Cluster.ListenForJoins() 2017-11-10 11:38:16 -06:00
Travis Turner
7e797efdc2
Allow CacheType to be set for a RangeEnabled frame (to apply to the standard frame) 2017-11-06 14:32:20 -06:00
Travis Turner
0d5a2e7bfd
add SetFieldValue() method to TestCluster and use in tests 2017-11-06 10:51:13 -06:00
Travis Turner
c7c1be6813
change read lock to write lock 2017-11-03 17:43:05 -05:00
Travis Turner
73b9d9fd85
Add Cluster resize tests.
Consolidate schema creation into Holder.ApplySchema.
Add view names to proto schema.
2017-11-03 17:22:39 -05:00
Travis Turner
a8871ada6a
Convert Host to URI.
Fix all compile errors.
2017-10-25 11:52:55 -05:00
Travis
f1e3ac90d4
Determine cluster membership via gossip.
Handle resize cluster events.
Add Toplogy support.
Refactor FrameOptions.
Add tests.
2017-10-25 00:27:30 -05:00
Yuce Tekol
a95b09d30d
more host string to uri changes 2017-10-04 15:29:00 +03:00
Cody Soyland
85b1a73b73 Refactor test utilities into importable package.
Remove duplicate instances of test utilities from pilosa.ctl.
Now subpackages such as pilosa.ctl may import test utilities.
2017-06-23 09:10:15 -05:00