-
Notifications
You must be signed in to change notification settings - Fork 4
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
[DPE-2095] integration tests to pytest #16
Conversation
0ecc707
to
7704604
Compare
dict(os.environ) | {"KUBECONFIG": f"{os.environ['HOME']}/.kube/config"} | ||
@pytest.mark.parametrize( | ||
"namespace, user", | ||
[("default-namespace", "spark"), ("spark-namespace", "spark-user")], |
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.
[note] I'm much wondering that we should not be using the same namespace across multiple tests (except default
), as it prevents us from being able to run our tests simultaneously.
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.
Yes, makes sense, we could randomize this, but let's do this later. Not needed at this point
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.
That's kinda half-true -- well true as long as there are no LightKube
tests ;-)
Turns out that LightKube
is a lot slower in removing namespaces than doing it directly with kubectl
. Thus if you want to reuse the name of a namespace (that's just been cleaned up) in a subsequential test, it will fail with an error indicating that the namespace is just being deleted.
You'll see it later, when LightKube
tests are finally activated and passing, I had to randomize the names manually already. (The change was introduced "passively" (xfail
) in PR #17 -- however I'm using the below references from PR https://github.com/canonical/spark-k8s-toolkit-py/pull/19/files#diff-cdd7ffd3e23e3cfe0690b94308e2a7b70a22c89a08aa78b06396b7e382c38c47L71 where the tests are actually enabled and passing.)
- https://github.com/canonical/spark-k8s-toolkit-py/pull/19/files#diff-cdd7ffd3e23e3cfe0690b94308e2a7b70a22c89a08aa78b06396b7e382c38c47L24
- https://github.com/canonical/spark-k8s-toolkit-py/pull/19/files#diff-cdd7ffd3e23e3cfe0690b94308e2a7b70a22c89a08aa78b06396b7e382c38c47L71
I'll do this on a nice centralized fixture level later.
(This PR is to be kept as clean as possible as a direct mapping between unittest -> pytest).
fd81bf1
to
cbf7d15
Compare
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.
LGTM
cbf7d15
to
8ee05e2
Compare
Blindly moving from unittest to pytest, as a pre-stage to complete DPE-2021.
Related, dependent PR is #17
Stateful, "cleaning up after myself" tests not used anymore.
Instead we have reliable fixtures always ensuring a clean state (in terms of namespaces).
(Note: So far I see no desperate need to clean up the
default
namespace, but can be added if needed)Furthermore
tests/__init__.py
is cleaned up (none of the content was needed there).While it may be difficult to review changes, note that test coverage is equal to the last one before this PR:
New execution