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

feat(rpm_repository): add retain_repo_versions parameter #171

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

joey-grant
Copy link
Contributor

This change adds retain_repo_versions parameter option to rpm_repository module.

@joey-grant
Copy link
Contributor Author

This is related to #165

Copy link
Member

@mdellweg mdellweg left a comment

Choose a reason for hiding this comment

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

How do you feel about adding tests?
These modules are about to be transfered to a new framework. Adding this parameter to the tests will ensure it's not immediately broken afterwards.
(Please do not test the retain version feature, but just that the model is able to set it on a repository.)

@@ -41,6 +41,10 @@
- Max number of latest versions of each package to keep (optional)
type: int
version_added: "0.0.16"
retain_repo_versions:
description:
- Max number of repository versions to keep (optional)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Max number of repository versions to keep (optional)
- Max number of repository versions to keep

not being required is implied by ansible. Can you adjust line 41 too?

Also version_added may be nice.

Copy link
Contributor Author

@joey-grant joey-grant Jul 26, 2024

Choose a reason for hiding this comment

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

Thanks for the feedback, @mdellweg . I've made the adjustments and will submit them soon.

Can you confirm what you would like to see regarding tests? I have produced 2 tests:

  1. set retain_repo_versions to 5
  2. update retain_repo_versions to 1 (i.e. don't keep old versions)

I have ran and recorded the tests--they all pass. However, I see the following now:

  1. all existing tests/fixtures/rpm_repository-*.yml files have been modified
  2. 2 new fixture files were created: test/fixtures/rpm_repository-{22,23}.yml

What portions of the tests/results would you like committed?

Side note:
There seems to be a limitation in which every call that includes the retain_repo_versions parameter updates the returned pulp_last_updated timestamp (no other returned values differ). This is the case even when retain_repo_versions is not changed from the previous call. I assume this is a bug in pulpcore itself; however, it does limit the ability to assert results.changed == false on repeated calls with the same value for retain_repo_versions.

Copy link
Member

Choose a reason for hiding this comment

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

What portions of the tests/results would you like committed?

All of them. They are separate files for technical reasons only.

Side note: [...]

That actually sounds like a bug on the client side. When we don't want to change the value, we must not do a patch call, and that still seems to happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @mdellweg, I have changed the tests to try for idempotence and am not seeing the previous issue. I believe that I must have made an error in my original work. Please see my changes and let me know if there is anything else needed for approval.

I appreciate you allowing me to contribute to this project.

@joey-grant joey-grant changed the title feat: add retain_repo_versions to rpm_repository feat(rpm_repository): add retain_repo_versions parameter option Jul 26, 2024
@joey-grant joey-grant changed the title feat(rpm_repository): add retain_repo_versions parameter option feat(rpm_repository): add retain_repo_versions parameter Jul 26, 2024
@joey-grant joey-grant force-pushed the develop branch 3 times, most recently from 07678c0 to 74b2877 Compare July 27, 2024 17:33
mdellweg
mdellweg previously approved these changes Jul 29, 2024
Copy link
Member

@mdellweg mdellweg left a comment

Choose a reason for hiding this comment

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

This looks good.
Thank you!

@mdellweg
Copy link
Member

Looks like you need to run "make format" once.

This change adds `retain_repo_versions` parameter option to
`rpm_repository` module. It also adds tests and associated
fixtures.

fixes pulp#165
@joey-grant
Copy link
Contributor Author

Looks like you need to run "make format" once.

Hey @mdellweg, I've pushed the newly formatted code.

Copy link
Member

@mdellweg mdellweg left a comment

Choose a reason for hiding this comment

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

Thank you for following along.

@mdellweg mdellweg merged commit 3ad0309 into pulp:develop Jul 30, 2024
7 checks passed
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