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

Remove test-function-check_playbook_file_removed_and_added test #10982

Conversation

marcusburghardt
Copy link
Member

@marcusburghardt marcusburghardt commented Aug 11, 2023

Description:

The ansible-file-removed-and-added test in upstream CI is a very slow test which usually takes 8 - 10 minutes, as reported by @jan-cerny. I investigated this case and concluded the test can be safely removed.

Context:
The test was introduced to catch a very specific case already fixed by #7228
I believe this was one of my first PRs in the project and on it I fixed an inefficient usage of Ansible modules.
The Playbook should use the copy module for that specific case but instead it used an inefficient combination of file and lineinfile to achieve the same outcome.
Back in the time I remember to search this pattern in other rules but this was, fortunately, the unique case I found.

So, the test was introduced by #7376 in order to catch if this specific case is again proposed in any PR.

Rationale:

It is very hard to have this specific case again in any PR. This never happened again in within at least two years.
If this happen, it is also pretty easy to see during the review of Ansible playbooks. If not, it is not also harmful. It will show unnecessary changed in a eventual task.

  • Make tests more efficient
  • Save a lot of time and resources

Review Hints:

This PR simply removes stuff. If nothing is broken by these changes, it should be fine.

It was concluded this test is too costy for the benefit it brings.
It takes about 10 minutes and search for a very specific and rare
pattern with is also pretty easy to be caught during review.
These scripts are no longer necessary.
It was only used by test_ansible_file_removed_and_added.py script.
@marcusburghardt marcusburghardt added enhancement General enhancements to the project. Test Suite Update in Test Suite. Highlight This PR/Issue should make it to the featured changelog. labels Aug 11, 2023
@github-actions
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@jan-cerny jan-cerny self-assigned this Aug 11, 2023
@codeclimate
Copy link

codeclimate bot commented Aug 11, 2023

Code Climate has analyzed commit ab8570f and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 53.3% (0.0% change).

View more on Code Climate.

@jan-cerny
Copy link
Collaborator

/packit test

Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

Thanks for the detailed investigation. It's definitely a speed up.

The Rawhide fails aren't related to the contents of this PR.

@jan-cerny jan-cerny merged commit 3407ef7 into ComplianceAsCode:master Aug 11, 2023
28 of 31 checks passed
@jan-cerny jan-cerny added this to the 0.1.70 milestone Aug 11, 2023
@marcusburghardt marcusburghardt deleted the test_ansible_file_removed_and_added branch August 11, 2023 11:56
@Mab879 Mab879 mentioned this pull request Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement General enhancements to the project. Highlight This PR/Issue should make it to the featured changelog. Test Suite Update in Test Suite.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants