mirror of https://github.com/hashicorp/consul
da2a57239e
Introduce randomized timings and reproducible randomization into controller integration tests. As the V2 architecture hinges on eventual consistency and controllers reconciling the existing state in response to writes, there are potential issues we could run into regarding ordering and timing of operations. We want to be able to guarantee that given a set of resources the system will always eventually get to the desired correct state. The order of resource writes and delays in performing those writes should not alter the final outcome of reaching the desired state. To that end, this commit introduces arbitrary randomized delays before performing resources writes into the `resourcetest.Client`. Its `PublishResources` method was already randomizing the order of resource writes. By default, no delay is added to normal writes and deletes but tests can opt-in via either passing hard coded options when creating the `resourcetest.Client` or using the `resourcetest.ConfigureTestCLIFlags` function to allow processing of CLI parameters. In addition to allowing configurability of the request delay min and max, the client also has a configurable random number generator seed. When Using the CLI parameter helpers, a test log will be written noting the currently used settings. If the test fails then you can reproduce the same delays and order randomizations by providing the seed during the previous test failure. # Conflicts: # internal/catalog/catalogtest/run_test.go # internal/catalog/catalogtest/test_integration_v2beta1.go # test/integration/consul-container/test/catalog/catalog_test.go Co-authored-by: Matt Keeler <mjkeeler7@gmail.com> |
||
---|---|---|
.. | ||
demo | ||
http | ||
mappers | ||
protoc-gen-deepcopy | ||
protoc-gen-json-shim | ||
protoc-gen-resource-types | ||
reaper | ||
resourcetest | ||
testdata | ||
acls.go | ||
authz.go | ||
authz_ce.go | ||
authz_ce_test.go | ||
decode.go | ||
decode_test.go | ||
equality.go | ||
equality_test.go | ||
errors.go | ||
errors_test.go | ||
filter.go | ||
filter_test.go | ||
reference.go | ||
refkey.go | ||
refkey_test.go | ||
registry.go | ||
registry_test.go | ||
sort.go | ||
sort_test.go | ||
stringer.go | ||
tenancy.go | ||
tenancy_bridge_ce.go | ||
tenancy_test.go | ||
tombstone.go |