Skip to content

Improve golden master tests#59

Open
MJGaughran wants to merge 19 commits into
mainfrom
improve-golden-master-tests
Open

Improve golden master tests#59
MJGaughran wants to merge 19 commits into
mainfrom
improve-golden-master-tests

Conversation

@MJGaughran

@MJGaughran MJGaughran commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

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.

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.33333% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.59%. Comparing base (093ffa8) to head (22028aa).

Files with missing lines Patch % Lines
src/deploy_tools/external_tools.py 46.15% 7 Missing ⚠️
src/deploy_tools/validate.py 50.00% 3 Missing ⚠️
src/deploy_tools/__main__.py 71.42% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +43 to +47
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell it only raises FileNotFoundError when the command itself cannot be run.

Comment thread src/deploy_tools/print_updates.py Outdated
@@ -39,7 +42,9 @@ def _print_version_updates(
module_names = old_defaults.keys() | new_defaults.keys()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It might clarify things to type hint this as a set, this would also be consistent with update_messages being type hinted.

Comment thread src/deploy_tools/print_updates.py Outdated
Comment on lines +45 to +47
# Sort for stable output: module_names is a set, whose iteration order depends on
# PYTHONHASHSEED.
for name in sorted(module_names):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread tests/test_golden_master.py
Comment thread tests/test_schema_gen.py Outdated
Comment on lines +6 to +8
PATH_TO_SCHEMAS = (
Path(__file__).parent.parent / "src" / "deploy_tools" / "models" / "schemas"
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this path being used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This will be deleted

Comment on lines +1 to +3
# yaml-language-server: $schema=/workspaces/deploy-tools/src/deploy_tools/models/schemas/deployment-settings.json

default_versions: {}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are there any tests of modifying the default versions as defined in this file?

Comment thread tests/configs/golden-master/01-initial/apps/0.1.yaml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.
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.

3 participants