add deterministic simulated Kubernetes (dsk) package#85
Open
ecordell wants to merge 1 commit intoauthzed:mainfrom
Open
add deterministic simulated Kubernetes (dsk) package#85ecordell wants to merge 1 commit intoauthzed:mainfrom
ecordell wants to merge 1 commit intoauthzed:mainfrom
Conversation
ff23c70 to
f856e74
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces
dsk: an in-process simulation layer for testing Kubernetes controllers.Check out the README for an in depth overview.
The core abstraction is the tick: a deterministic delta cycle that buffers watch events and delivers them only when the test calls
Flush()orTick(), then waits for all resulting reconciles to complete before returning. This is borrowed from VHDL delta-cycle simulation (which I have read about but never used, I could be stretching the analogy without realizing).This makes some difficult to test controller bug classes testable:
IsSteady()or fail at a max-tick limit, catching both slow convergence (assert on tick count) and infinite requeue loops (never reaches steady state)Buffer()returns pending events as a slice; tests can explicitly deliver them in any order or use a property-testing library to enumerate all permutationsdskworks with both fake clients (reactor path) and real clients via envtest/kind (HTTP transport path).It also includes:
FaultBuilderDSLasynchandlerstatic analyzer that catchesAddRateLimitedcalls inside reconcile handlers beforeDone()is called (this is almost always a bug, but it's important for the correctness of dsk that queue add calls be syncronous)