Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture and playback of events for testing #32

Merged
merged 7 commits into from
May 19, 2021
Merged

Capture and playback of events for testing #32

merged 7 commits into from
May 19, 2021

Conversation

bboreham
Copy link
Collaborator

@bboreham bboreham commented May 18, 2021

So we can record a sequence of inputs (coming from k8s api-server) then create unit tests by playing them back.

Note the "capture initial state" code in this PR is incomplete, because #2 has a better way of doing it but I am merging the work done for #2 in stages.

Add a small package `mtime` which will return a defined value in place
of `time.Now()`, so that tests which depend on timing can be repeated.
Needed for object capture used in testing
So we can record a sequence of inputs then create unit tests by
playing them back.
Actually it is capturing every version fetched.

This code is temporary; will be replaced in a subsequent commit
with a version that only outputs the first version seen as 'initial'.
Read object updates and events from a file and play them back as if
they came from Kubernetes, for testing.
Essentially the test is the same, but with data captured using the
new framework. Test data is now in a yaml file rather than Go code.
@bboreham bboreham merged commit e57149c into main May 19, 2021
@bboreham bboreham deleted the playback branch May 19, 2021 10:29
bboreham added a commit that referenced this pull request May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant