improve the /Sanity/rules-d test for CentOS stream - #17
milosmalik wants to merge 1 commit into
Conversation
Summary of ChangesHello @milosmalik, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request aims to enhance the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to improve the Sanity/rules-d test for CentOS Stream. The changes to package requirements in main.fmf are appropriate. However, the modifications in runtest.sh introduce some concerns. Key test validations have been commented out, and a risky --enablerepo '*' flag has been added. I've provided a suggestion to replace this with more robust, distribution-aware logic. Additionally, there's some code redundancy that should be cleaned up to improve maintainability. Overall, the changes are a good step towards CentOS Stream support but require refinement for robustness and clarity.
| # tcfRun "rlCheckMakefileRequires" || rlDie "cannot continue" | ||
| # rlRun "dnf repolist enabled | grep rhel-CRB" 0 "Check if required rhel-CRB repo is enabled" || rlDie "cannot continue" | ||
| # || "dnf config-manager --set-enabled rhel-CRB" | ||
| rlRun "yumdownloader --source fapolicyd" | ||
| rlRun "yum-builddep ./fapolicyd-*.src.rpm --enablerepo '*' -y" |
There was a problem hiding this comment.
This block has a couple of issues that should be addressed for robustness and maintainability:
- Disabled Checks: Important checks for RHEL environments on lines 35-36 have been commented out. This can hide potential issues on RHEL. These should be executed conditionally.
- Broad Repository Enablement: Using
--enablerepo '*'on line 39 is risky as it can pull dependencies from unexpected sources. It's much safer to enable only the specific repositories required.
A better approach is to detect the distribution and configure the necessary repositories (like rhel-CRB for RHEL or crb for CentOS Stream) before installing build dependencies. This makes the test more reliable.
| # tcfRun "rlCheckMakefileRequires" || rlDie "cannot continue" | |
| # rlRun "dnf repolist enabled | grep rhel-CRB" 0 "Check if required rhel-CRB repo is enabled" || rlDie "cannot continue" | |
| # || "dnf config-manager --set-enabled rhel-CRB" | |
| rlRun "yumdownloader --source fapolicyd" | |
| rlRun "yum-builddep ./fapolicyd-*.src.rpm --enablerepo '*' -y" | |
| if rlIsRHEL; then | |
| tcfRun "rlCheckMakefileRequires" || rlDie "cannot continue" | |
| rlRun "dnf repolist enabled | grep rhel-CRB" 0 "Check if required rhel-CRB repo is enabled" || rlDie "cannot continue" | |
| elif rlIsRHELLike; then | |
| # For RHEL-like distros (e.g., CentOS Stream), enable the 'crb' repository. | |
| rlRun "dnf config-manager --set-enabled crb" 0 "Enable crb repo for build dependencies" | |
| fi | |
| rlRun "yumdownloader --source fapolicyd" | |
| rlRun "yum-builddep ./fapolicyd-*.src.rpm -y" |
| rlRun "yumdownloader --source fapolicyd" | ||
| rlRun "yum-builddep ./fapolicyd-*.src.rpm --enablerepo '*' -y" |
There was a problem hiding this comment.
These commands to download the source RPM and install build dependencies appear to be redundant with rlFetchSrcForInstalled on line 51 and the yum-builddep call on line 53. To improve clarity and avoid duplicate effort, please consider removing the older, redundant commands. This may already be planned as part of this work-in-progress.
346aa69 to
d1c7385
Compare
The test should not exit prematurely when the CRB repository is not available.
d1c7385 to
f247c33
Compare
…ging Environment / setup - Source rhts-environment.sh only when present (Fedora/tmt has no rhts package). - Replace rlCheckMakefileRequires with rlCheckRecommended; rlCheckRequired for FMF-only runs. - Replace hard require on rhel-CRB with best-effort CRB/powertools/crb/codeready-builder enablement and dnf5-friendly config-manager variants (see also PR linux-application-whitelisting#17 discussion). - main.fmf: recommend /usr/bin/rpmbuild and rpmdevtools (repoquery/vercmp for older-NVR logic). Local repo and tooling - Stop dnf config-manager --add-repo (missing on dnf5); write a dedicated .repo under /etc/yum.repos.d with absolute baseurl=file://…/rpms and register cleanup. - Add fap_repoquery() wrapper (dnf vs yum repoquery). Tests / assertions - Concurrent rules: expect "both old and new rules exist" from journalctl (plus fapStart log); document expected rlServiceStart ERROR; short sleep before journal. - Upgrade to _99 with updated defaults: on Fedora, rm -f rules.d/*.rules before install so %post repopulates from new sample-rules (perm=any); RHEL-like unchanged. - Uninstall default rules: assert rpm -q fapolicyd fails; Fedora expects rules.d file count unchanged; RHEL-like expects empty rules.d if directory remains. Signed-off-by: jjanasek <jjanasek@redhat.com>
…ging Environment / setup - Source rhts-environment.sh only when present (Fedora/tmt has no rhts package). - Replace rlCheckMakefileRequires with rlCheckRecommended; rlCheckRequired for FMF-only runs. - Replace hard require on rhel-CRB with best-effort CRB/powertools/crb/codeready-builder enablement and dnf5-friendly config-manager variants (see also PR linux-application-whitelisting#17 discussion). - main.fmf: recommend /usr/bin/rpmbuild and rpmdevtools (repoquery/vercmp for older-NVR logic). Local repo and tooling - Stop dnf config-manager --add-repo (missing on dnf5); write a dedicated .repo under /etc/yum.repos.d with absolute baseurl=file://…/rpms and register cleanup. - Add fap_repoquery() wrapper (dnf vs yum repoquery). Tests / assertions - Concurrent rules: expect "both old and new rules exist" from journalctl (plus fapStart log); document expected rlServiceStart ERROR; short sleep before journal. - Upgrade to _99 with updated defaults: on Fedora, rm -f rules.d/*.rules before install so %post repopulates from new sample-rules (perm=any); RHEL-like unchanged. - Uninstall default rules: assert rpm -q fapolicyd fails; Fedora expects rules.d file count unchanged; RHEL-like expects empty rules.d if directory remains. Signed-off-by: jjanasek <jjanasek@redhat.com>
…ging Environment / setup - Source rhts-environment.sh only when present (Fedora/tmt has no rhts package). - Replace rlCheckMakefileRequires with rlCheckRecommended; rlCheckRequired for FMF-only runs. - Replace hard require on rhel-CRB with best-effort CRB/powertools/crb/codeready-builder enablement and dnf5-friendly config-manager variants (see also PR linux-application-whitelisting#17 discussion). - main.fmf: recommend /usr/bin/rpmbuild and rpmdevtools (repoquery/vercmp for older-NVR logic). Local repo and tooling - Stop dnf config-manager --add-repo (missing on dnf5); write a dedicated .repo under /etc/yum.repos.d with absolute baseurl=file://…/rpms and register cleanup. - Add fap_repoquery() wrapper (dnf vs yum repoquery). Tests / assertions - Concurrent rules: expect "both old and new rules exist" from journalctl (plus fapStart log); document expected rlServiceStart ERROR; short sleep before journal. - Upgrade to _99 with updated defaults: on Fedora, rm -f rules.d/*.rules before install so %post repopulates from new sample-rules (perm=any); RHEL-like unchanged. - Uninstall default rules: assert rpm -q fapolicyd fails; Fedora expects rules.d file count unchanged; RHEL-like expects empty rules.d if directory remains. Signed-off-by: jjanasek <jjanasek@redhat.com>
WIP - do not merge yet