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

Create a minimalist reproduction of content directory for unit tests #12819

Merged

Conversation

marcusburghardt
Copy link
Member

Description:

With the introduction of #12797, during the development of unit tests it was not simple to mock all necessary information in runtime. The existing directory structure in ssg-module/data was not sufficient as well and I would like to avoid duplicating much data so it was temporarily used real content for unit tests, which is not ideal.

In a discussion with @vojtapolasek , he proposed a minimalist reproduction of content directory including the necessary files for unit tests and this PR is just some minor improvements and cleanup on top of it.

More context in #12797 (comment)

Rationale:

  • Create a minimalist example of content directory that can be scaled on-demand.
  • Fix the temporary approach to use real content in unit tests.

Review Hints:

python -m pytest tests/unit/ssg-module/test_profiles.py

@marcusburghardt marcusburghardt added the Test Suite Update in Test Suite. label Jan 13, 2025
@marcusburghardt marcusburghardt added this to the 0.1.76 milestone Jan 13, 2025
Copy link

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

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@marcusburghardt marcusburghardt marked this pull request as draft January 13, 2025 23:04
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Jan 13, 2025
@jan-cerny
Copy link
Collaborator

It's a great idea 👍

@marcusburghardt marcusburghardt marked this pull request as ready for review January 14, 2025 08:15
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Jan 14, 2025
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.

I have played with the test test_profiles.py, I have add there more asserts to verify that it really uses the data in the data/content_dir directory. I think that the data are a good basis for many unit tests.

@marcusburghardt
Copy link
Member Author

Failed CI tests for Fedora latest are workarounded by #12821

vojtapolasek and others added 5 commits January 14, 2025 15:11
Just removed long text from files in order to make them easier to be
read. Also some minor updates regarding indentation.

Signed-off-by: Marcus Burghardt <[email protected]>
Signed-off-by: Marcus Burghardt <[email protected]>
@marcusburghardt
Copy link
Member Author

I just rebased after #12821

Copy link

codeclimate bot commented Jan 14, 2025

Code Climate has analyzed commit 8811f13 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 61.8% (0.0% change).

View more on Code Climate.

@jan-cerny jan-cerny self-assigned this Jan 15, 2025
@jan-cerny jan-cerny merged commit 6e79ee6 into ComplianceAsCode:master Jan 15, 2025
108 of 109 checks passed
@marcusburghardt marcusburghardt deleted the ssg_profiles_test_unit branch January 15, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Test Suite Update in Test Suite.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants