forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(component validation): make tests deterministic through absolute …
…comparisons instead of bounds checks (vectordotdev#17956) ### Changes - Fixes a bug which was occasionally circumvented by comparing against a lower bound for some of the _bytes metrics- it seems the offered reasoning for the lower bound (inability to synchronize with the component's internal logic) was inaccurate. - The bug itself was that we were converting the `EventData` read from the yaml file, into a proper Event (and thus generating metadata for it), in two places- first when sending the event as input in the input runner, and again in the validator to construct the expected result. Because the event construction adds a timestamp, and because our determination of timestamp precision is based on whether there are trailing zeros that can be trimmed, this created a scenario where the actual event input to the component under test, and the event used to calculated expected metrics, had a timestamp that varied in it's number of bytes. This of course did not happen all of the time, which meant that the tests sometimes passed and sometimes failed. - The fix for this is to create the proper Event immediately after parsing the EventData from the yaml file (thereby only creating it once). - Moves the calculation of expected metrics, out of the Validators and up to the input/output runners. This removes the need for a lot of logic that was previously being done in the Validators. - Increases the static sleep we have when initializing the runner topology from 1s to 2s, and additionally increased the number of internal metric ticks to wait for before shutting down the telemetry from 2 ticks to 3. I found through experimentation that occasionally we would receive no events. The two attributes were increased independently and it was only through increasing both that the pass rate became 100%. - Extracts duplicated code in the sources validator functions into helper functions. ### Testing Done The tests were run in a loop, stopping on the first failure. This method was used to calibrate the waits we have on the topology as mentioned above. Before the current settings, the maximum sequential passes was about 100. With the current settings, the loop was manually stopped at about 1.2k iterations.
- Loading branch information
Showing
10 changed files
with
426 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.