Improve golden master tests#59
Conversation
No longer uses the demo_configuration folder for test configuration.
This includes sorting output to ensure it is deterministic. The 'file' utility has been installed to allow tests to run on the devcontainer.
These are caught in the main() function and printed without traceback to reduce clutter in failed runs.
This removes the need to depend on an image pull in CI.
These were stripped down for the golden master tests, but those are now using separate configuration.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #59 +/- ##
==========================================
+ Coverage 75.51% 83.59% +8.08%
==========================================
Files 25 27 +2
Lines 931 957 +26
==========================================
+ Hits 703 800 +97
+ Misses 228 157 -71 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| except FileNotFoundError as exc: | ||
| raise ExternalToolError( | ||
| f"Required external tool not found: '{executable}'.\n" | ||
| f"Ensure it is installed and available on PATH." | ||
| ) from exc |
There was a problem hiding this comment.
Does this exception only get raised when the tool itself cant be found, rather than if the tool fails to find a file in cases where the tool handles files/directories? I guess if the tool failed to find a file, it would return non zero which would raise a CalledProcessError
There was a problem hiding this comment.
As far as I can tell it only raises FileNotFoundError when the command itself cannot be run.
| @@ -39,7 +42,9 @@ def _print_version_updates( | |||
| module_names = old_defaults.keys() | new_defaults.keys() | |||
There was a problem hiding this comment.
It might clarify things to type hint this as a set, this would also be consistent with update_messages being type hinted.
| # Sort for stable output: module_names is a set, whose iteration order depends on | ||
| # PYTHONHASHSEED. | ||
| for name in sorted(module_names): |
There was a problem hiding this comment.
This is definitely very nitpicky and you don't need to change anything, but this comment seems a bit over the top. It is explaining how a sets order is defined which isn't really relevant. All it needs to say, is something like "sort unordered set to give reproducible order". I wonder if this is Claude being overly verbose?
There was a problem hiding this comment.
Pretty much every single comment is trimmed down from perhaps triple the original output. The only way to avoid the spam is to use Claude on a lower effort level, which often results in basic logic errors.
I agree it's OTT in this instance, I'll type hint it as set[str] above, and skip this comment entirely.
| PATH_TO_SCHEMAS = ( | ||
| Path(__file__).parent.parent / "src" / "deploy_tools" / "models" / "schemas" | ||
| ) |
There was a problem hiding this comment.
This will be deleted
| # yaml-language-server: $schema=/workspaces/deploy-tools/src/deploy_tools/models/schemas/deployment-settings.json | ||
|
|
||
| default_versions: {} |
There was a problem hiding this comment.
Are there any tests of modifying the default versions as defined in this file?
There was a problem hiding this comment.
This file has been added in preparation for the next test, but given that test two was 'added' and this test is 'updated' it is a little confusing.
Could version 2.0 be deprecated instead?
I see that you are also testing the version order to make sure 2.0 takes precedence over 2.1rc1. Another thought is that you could add this file in the initial deployment and test that behaviour there. Or at least in test 2 where it can be justified as being 'added'.
There was a problem hiding this comment.
updatable will be added from 01-initial, and both new versions will be added in 02-added
Instead, we clearly indicate that the type is a set (and that therefore sorting is necessary).
The 'updatable' module has now been added from the start, and both new versions are added in 02-added. The test description has been updated to reflect these changes.
This now exercises multiple stages of the module lifecycle, such as deprecation, removal, restore etc.
This includes the refactor to use a single DeployToolsError, since that was used in the code for patching out the apptainer pull from the lifecycle test. Other code changes (other than applying consistent type hints) have been reserved for the PR that will include the CLI / command testing.
There are a lot of changed files since we have all the different configuration files and generated output. I have tried to name the modules to indicate their purpose, and they have been stripped down from the originals.
You'll probably want to minimise the tests/configs & tests/samples to start rather than read all "Files changed" top-to-bottom.