feature: add kubernetes api_client parameter to kubetest client - #144
Open
edaniszewski wants to merge 3 commits into
Open
feature: add kubernetes api_client parameter to kubetest client#144edaniszewski wants to merge 3 commits into
edaniszewski wants to merge 3 commits into
Conversation
|
To my knowledge we have to patch everything under For instance I'm currently monkeypatching a lot of those in my tests. |
Contributor
Author
|
Good point. I've updated so that all api objects which the TestClient creates get the I'm not totally convinced this implementation is great largely because there are a few api objects (role bindings, cluster role bindings) which are set up via markers and are done before the test starts, so there isn't a good way of sharing the client with them. |
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.
This PR:
api_clientparameter to pass to the Kubernetes client.api_clientCaveats:
In order for the test client (e.g. returned by the
kubefixture) to use a custom api_client, the test author must manually set it at the top of the test, e.g.Interactions through the
kubeclient will have access to the custom client and will use it if set, however if any of the kubetest object wrappers (e.g.kubetest.objects.deployment.Deployment) are initialized manually:then they will not have access to the custom client because there is no direct link to the currently active test client. it could be added in the future, but that requires a hard look at the design and any implications it would have, particularly if tests are run in parallel. For now, if its required that an object is initialized directly, the
api_clientcan be passed directly to itRelated: