consul/internal/catalog/catalogtest
Matt Keeler a7774a9538
Introduce randomized timings and reproducible randomization into controller integration tests. (#19393)
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.
2023-11-08 10:45:25 -05:00
..
helpers catalog, mesh: implement missing ACL hooks (#19143) 2023-10-13 23:16:26 +00:00
integration_test_data/v2beta1 catalog,mesh,auth: Bump versions to v2beta1 (#18930) 2023-09-22 10:51:15 -06:00
run_test.go Introduce randomized timings and reproducible randomization into controller integration tests. (#19393) 2023-11-08 10:45:25 -05:00
test_integration_v2beta1.go Introduce randomized timings and reproducible randomization into controller integration tests. (#19393) 2023-11-08 10:45:25 -05:00
test_lifecycle_v2beta1.go Introduce randomized timings and reproducible randomization into controller integration tests. (#19393) 2023-11-08 10:45:25 -05:00