Skip to content
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

make csi pit format --write-script optional to fix CASMTRIAGE-7156 #409

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

jacobsalmela
Copy link
Contributor

this commit could have been a one line change to remove the
MarkFlagRequired() directive, but in an effort to improve the quality
and confidence of our tooling, I opted to create a new test for this.

this involved creating a new type, WriteLiveCDFunc, which is accepted as
a parameter.

this is required to replace the real implementation with a mock in the
go tests. this is especially important in this function since it could
destructively format a disk, so if you accidently gave it some bad
parameters, there is a possibility it may format something unintended.
this also allows finer control over what portions of the function to
test.

in this case, I mererly test that the function does not require the
--write-script flag.

further tests could certainly be added, but as CSM is EOL, I am adding
best effort tests here without going overboard.

this flag was actually marked required prior to the refactor by @rustydb
in https://github.com/Cray-HPE/cray-site-init/pull/391/files#diff-560a2ff11144e84b5ea4611785932f2f29ed01f545fbf1b61c83de7b4a56c07eL82

it is likely that the poor layout of this project at that time prevented
it from being enforced. either way, it does not need to be a required
flag since we set a default that is used in almost all cases and having
it required deviates from the documenation and causes confusion.

Signed-off-by: Jacob Salmela [email protected]

@jacobsalmela jacobsalmela self-assigned this Jul 18, 2024
@jacobsalmela jacobsalmela marked this pull request as ready for review July 18, 2024 17:59
@jacobsalmela jacobsalmela requested a review from a team as a code owner July 18, 2024 17:59
jacobsalmela and others added 2 commits July 23, 2024 10:30
this commit could have been a one line change to remove the
MarkFlagRequired() directive, but in an effort to improve the quality
and confidence of our tooling, I opted to create a new test for this.

this involved creating a new type, WriteLiveCDFunc, which is accepted as
a parameter.

this is required to replace the real implementation with a mock in the
go tests.  this is especially important in this function since it could
destructively format a disk, so if you accidently gave it some bad
parameters, there is a possibility it may format something unintended.
this also allows finer control over what portions of the function to
test.

in this case, I mererly test that the function does not require the
--write-script flag.

further tests could certainly be added, but as CSM is EOL, I am adding
best effort tests here without going overboard.

this flag was actually marked required prior to the refactor by @rustydb
in https://github.com/Cray-HPE/cray-site-init/pull/391/files#diff-560a2ff11144e84b5ea4611785932f2f29ed01f545fbf1b61c83de7b4a56c07eL82

it is likely that the poor layout of this project at that time prevented
it from being enforced.  either way, it does not need to be a required
flag since we set a default that is used in almost all cases and having
it required deviates from the documenation and causes confusion.

Signed-off-by: Jacob Salmela <[email protected]>
Co-authored-by: Russell Bunch <[email protected]>
Signed-off-by: Jacob Salmela <[email protected]>
Signed-off-by: Jacob Salmela <[email protected]>
@rustydb rustydb merged commit b396fbc into main Jul 23, 2024
8 checks passed
@rustydb rustydb deleted the CASMTRIAGE-7156 branch July 23, 2024 20:28
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