featurebase/server
Seebs 364b533ead various cluster test fixups/cleanups
Some cluster tests failed sporadically. In order to fix them, I
introduced some debugging-related functionality, which revealed
several new bugs that were actually existing bugs we just happened
not to hit in testing. This combines various fixes.

We start with "make the nodes used in testing have distinct names
based on the test case name", which lets us discover that we are
leaking clusters, which continue to sit around talking with each
other. That in turn causes significantly higher load on access to
ephemeral ports, which causes sporadic failures when we shut a
node down and try to restart it, but something else has gotten assigned
its ephemeral port number since then.

Part of the fix is to try to rebind on port 0 if an attempt to
bind to a specified port over 32k fails. This is a guess; the
actual ephemeral port range could be 16k+, 32k+, or 48k+, or just
about anything else really, but it seems reasonable in
practice.

There were bugs in the oft-repeated loops to await the cluster
achieving a given state, and it could hang forever if it didn't,
so we add a timeout and a standard function on the test.Cluster
type to handle that. Note that the timeout seems irrelevant; in
every case I've tried, a timeout of 0 is fine because the node
start doesn't complete until the cluster state has changed.

Add a method to test.Command to run a query, expecting a specific
result. Also clean up some of the formatting and generation of
queries, and allow parameterized (badly) queries. This lets us fix
a subtle bug, which is that test cases were depending on assumptions
about shardwidths. Also improve the diagnostic output from some of
these functions so test failures are more comprehensible.

But actually that dependency on shardwidths was ALSO revealing a
genuine underlying bug, which is that a node resize did not correctly
propagate the schema to a new node if there was no data present
on shards that node would own. We now also have a test case that
hits that (or would, if we hadn't fixed it).

Add comments explaining the server options parameters for MustNewCluster
and MustRunCluster.

Also, we implement the ReadFrom and WriteTo behaviors for
InMemTranslateStore, without which some of the cluster resize tests
fail. Props to the comment for specifically stating that they wouldn't
work if that happened, which probably saved me several hours of
debugging. The implementations may not be robust, but
InMemTranslateStore is intended to be used only in lightweight
and transient testing.
2020-07-20 10:45:59 -05:00
..
testdata/certs regenerate certs with 100 year expiration, add README 2019-10-22 12:56:57 -05:00
cluster_test.go various cluster test fixups/cleanups 2020-07-20 10:45:59 -05:00
config.go add --advertise-grpc configuration option 2020-07-09 11:17:12 -05:00
config_internal_test.go add --advertise-grpc configuration option 2020-07-09 11:17:12 -05:00
config_test.go v2.0.0 2019-10-08 14:56:17 -06:00
default.go Unexport server.DefaultDiagnosticsInterval 2018-07-05 23:11:56 -05:00
dup.go Reduce duplication of setupLogger arch-specific code 2020-04-16 17:08:50 -05:00
dup_arm64.go Reduce duplication of setupLogger arch-specific code 2020-04-16 17:08:50 -05:00
grpc.go fix incorrect validation of query specification in Inspect 2020-07-10 14:35:30 -04:00
grpc_test.go Move grpc_internal_test to grpc_test 2020-05-15 19:52:03 +02:00
handler_test.go various cluster test fixups/cleanups 2020-07-20 10:45:59 -05:00
release.go Unexport server.DefaultDiagnosticsInterval (in release tag) 2018-07-05 23:11:57 -05:00
server.go various cluster test fixups/cleanups 2020-07-20 10:45:59 -05:00
server_test.go various cluster test fixups/cleanups 2020-07-20 10:45:59 -05:00
tlsconfig.go test and fix authentication of client certs btwn cluster nodes 2019-10-18 15:17:35 -05:00