Skip to content

Randomize application names in tests#1465

Merged
devdattakulkarni merged 7 commits into
cloud-ark:masterfrom
ishan-karmakar:tests-randomize-application-names
Jun 23, 2026
Merged

Randomize application names in tests#1465
devdattakulkarni merged 7 commits into
cloud-ark:masterfrom
ishan-karmakar:tests-randomize-application-names

Conversation

@ishan-karmakar

Copy link
Copy Markdown
Collaborator

Closes #1359

@ishan-karmakar ishan-karmakar marked this pull request as ready for review June 21, 2026 15:42
@ishan-karmakar ishan-karmakar force-pushed the tests-randomize-application-names branch from 4d321d1 to 2d3844e Compare June 21, 2026 15:51
Comment thread tests/application-upgrade/resource-composition-localchart.yaml Outdated
Comment thread tests/template-manifests/hello-world-hs1-replicas-2.yaml Outdated
Comment thread tests/tests.py Outdated
Comment thread tests/tests.py Outdated
Comment thread tests/tests.py
Comment thread tests/tests.py
Comment thread tests/tests.py

@devdattakulkarni devdattakulkarni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some comments.

@ishan-karmakar ishan-karmakar force-pushed the tests-randomize-application-names branch 5 times, most recently from 2fc4417 to 31b9e6e Compare June 22, 2026 19:46
@ishan-karmakar ishan-karmakar force-pushed the tests-randomize-application-names branch 2 times, most recently from 32153bb to 2e0fe18 Compare June 22, 2026 20:01
@devdattakulkarni

Copy link
Copy Markdown
Contributor

Here are some comments from GitHub Copilot:

A.
In cleanup() (application-upgrade section) there is:
cmd1 = f"kubectl delete -f {tenant_file} --kubeconfig=./application-upgrade/provider.conf"
TestKubePlus.run_command(cmd)
The code calls run_command(cmd) instead of run_command(cmd1). This looks like a copy/paste bug that will cause the delete to be skipped and the previous command to be run again. Search the file for similar patterns: assignment to cmd1 but calling cmd.
Fix: call TestKubePlus.run_command(cmd1) (or consolidate to reuse cmd variable consistently).

B. Use of classmethod parameter named self
Classmethods are defined as @classmethod def setUpClass(self): and def _process_template(self,…):
By convention and clarity, rename the first arg to cls (def setUpClass(cls): ... def _process_template(cls, file):). This avoids confusion between class and instance scope and makes code more idiomatic.
Functionally not fatal but improves readability.

C. Path.unlink(..., missing_ok=True) compatibility
Path.unlink(missing_ok=True) requires Python 3.8+. Ensure the CI/test runner uses Python >= 3.8. If CI uses older Python, this will fail; use try/except instead for maximum compatibility:
try: pathlib.Path(path).unlink() except FileNotFoundError: # Use some other Python approach to delete/unlink file.
D. Temporary files and cleanup robustness
tearDownClass deletes temp files recorded in self.tmp_files. Good, but ensure tearDownClass runs if tests abort early (unittest will call tearDownClass only if setUpClass succeeded; for other failures you may still leave temp files). Consider:
Using tempfile.TemporaryDirectory with context or registering cleanup via atexit, or wrapping test run with try/finally.
At minimum, keep current approach but handle FileNotFoundError (see C).

@ishan-karmakar ishan-karmakar force-pushed the tests-randomize-application-names branch from 223e248 to 2e89a8a Compare June 23, 2026 20:40
@devdattakulkarni

Copy link
Copy Markdown
Contributor

Looks good! 💯

@devdattakulkarni devdattakulkarni merged commit 2a2c877 into cloud-ark:master Jun 23, 2026
1 check passed
@ishan-karmakar ishan-karmakar deleted the tests-randomize-application-names branch June 23, 2026 23:12
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.

Update tests to use different application name per test

2 participants