Skip to content

Adjust error message to show that the capacity reservation does not exist #6887

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

Open
wants to merge 2 commits into
base: release-3.13
Choose a base branch
from

Conversation

hgreebe
Copy link
Contributor

@hgreebe hgreebe commented Jun 17, 2025

Description of changes

  • Adjust error message to show that the capacity reservation does not exist.
  • Orginal error can not be thrown here because then it causes a failure during cluster update.
  • This change only catches the error during cluster creation validation

Tests

  • Tested that the appropriate error message occurs during cluster creating when a capacity reservation is specified but not the instance type
  • Tested that the appropriate error message occurs during cluster creation when neither a capacity reservation or instance type is specified.
  • Ran full set of integration tests.

References

Please review the guidelines for contributing and Pull Request Instructions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hgreebe hgreebe requested review from a team as code owners June 17, 2025 14:52
@@ -500,6 +500,8 @@ def _validate_and_parse_config(
except ConfigValidationError as e:
raise e
except Exception as e:
if "Invalid type for parameter InstanceTypes[0], value: None, type: <class 'NoneType'>" in e.__str__():
Copy link
Contributor

Choose a reason for hiding this comment

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

The logici around exception raising should not be based on error messages, as it is a fragile approach. Error messages are meant to change over time.
The logic should be based on something more stable, such as exception types.

Copy link

codecov bot commented Jun 23, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 90.20%. Comparing base (960668b) to head (6672d3a).
Report is 32 commits behind head on release-3.13.

Files with missing lines Patch % Lines
cli/src/pcluster/models/cluster.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           release-3.13    #6887      +/-   ##
================================================
- Coverage         90.21%   90.20%   -0.01%     
================================================
  Files               181      181              
  Lines             16205    16211       +6     
================================================
+ Hits              14619    14623       +4     
- Misses             1586     1588       +2     
Flag Coverage Δ
unittests 90.20% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

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.

2 participants