-
Notifications
You must be signed in to change notification settings - Fork 304
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
Add a unit test for the spawner #407
Conversation
Looks great. Let's see if someone remembers why/if the Otherwise I think merging this is a no brainer :D Thanks for taking the time to increase the coverage by adding some nice tests |
tests/test_spawner.py
Outdated
# minikube cluster. | ||
c.KubeSpawner.node_selector = {'disktype': 'ssd'} | ||
c.KubeSpawner.namespace = kube_ns | ||
c.KubeSpawner.start_timeout = 30 # Do not wait very long. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.KubeSpawner.start_timeout = 30 # Do not wait very long. | |
c.KubeSpawner.start_timeout = 5 # Do not wait very long. |
This duration will increase the time to complete the tests significantly, so I suggest to make this duration quite low.
Co-authored-by: Developer <contact@paschen.ch>
67b85b1
to
7c1c81b
Compare
for more information, see https://pre-commit.ci
Unfortunately it looks like the internals of kubespawner have changed enough in the last 4 years that these tests no longer apply :( I'm going to close this PR for now, with apologies for the delay that caused this - am sorry @kpaschen! |
This adds a test for the case where a pod is unschedulable and never leaves 'pending'.
Also a test for what happens when the pod reflector is added twice, and a basic test about creating a pvc (I only test the easy bit here where it raises an ApiException; for testing non-exception case would need to use a mock or a fixture that ensures the pvc is deleted afterwards).
I made two changes to the spawner that need review from someone who knows this code -- both are in places where a TimeoutException has been caught, and the spawner prints 'restarting pods'. The original code calls 'raise' right after that, and that seemed odd, so I changed it. If you think that's wrong, please let me know!
This brings coverage to 78.19%.
I've also noticed that proxy.py appears unused -- I wasn't sure of the status of that code though.