You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would allow us to use this test struct to inject synthetic events (via e.g. TestStruct::new(list, stream)) that model actual apiserver responses (but without actually calling watch). This should allow us to verify a bunch of things from unit tests, such as (but not limited to):
watcher does indeed call list N times (depending on page sizes), and then watch
This has already been somewhat done to avoid the previous case triggering, but would like something a little more robust ideally. There's little distinction between list and watch in these mock tests atm and I have not been able to test the watch side with it. If this test harness can be made more robust then this is also helpful, but ideally we should have unit tests in the are where the code is present (rather than rely on top level stuff too much).
What problem are you trying to solve?
Avoiding releasing accidentally breaking watcher changes in the future.
0.92.0 had a change that passed 3 different types of tests; #1524 (comment) and still failed.
Describe the solution you'd like
Create a
#[cfg(test)]struct inwatcher.rsand provide an injectable test implementation ofApiModefor it:kube/kube-runtime/src/watcher.rs
Lines 158 to 170 in 01f9c0c
This would allow us to use this test struct to inject synthetic events (via e.g.
TestStruct::new(list, stream)) that model actual apiserver responses (but without actually calling watch). This should allow us to verify a bunch of things from unit tests, such as (but not limited to):listN times (depending on page sizes), and thenwatchlistin streaming listsIt also lets us verify that that we are handling edge cases (currently we have very little error testing here).
Describe alternatives you've considered
Extend mock tests in https://github.com/kube-rs/kube/blob/main/kube/src/mock_tests.rs#L29-L159
This has already been somewhat done to avoid the previous case triggering, but would like something a little more robust ideally. There's little distinction between
listandwatchin these mock tests atm and I have not been able to test the watch side with it. If this test harness can be made more robust then this is also helpful, but ideally we should have unit tests in the are where the code is present (rather than rely on top level stuff too much).Target crate for feature
kube-runtime