test: add test script for aznfs package#86
test: add test script for aznfs package#86lixuemin2016 merged 1 commit intolinux-system-roles:mainfrom
Conversation
Reviewer's GuideAdds an ansible-managed test script for the Azure NFS mount helper (aznfs) and installs it as an executable under the HPC Azure tests directory to validate aznfs package installation, watchdog service status, and basic mount readiness. Sequence diagram for executing the aznfs test scriptsequenceDiagram
actor Admin
participant TestScript as test_aznfs_sh
participant PackageManager as rpm_or_dpkg
participant Systemd as systemd
participant Shell as shell
Admin->>TestScript: Execute test_aznfs_sh
TestScript->>TestScript: Print header and start tests
TestScript->>PackageManager: Query aznfs package
PackageManager-->>TestScript: Package status
TestScript->>TestScript: Evaluate package installed
TestScript->>Admin: Print PASS or FAIL for package
TestScript->>Systemd: Check aznfswatchdog service status
Systemd-->>TestScript: Service active/inactive
TestScript->>TestScript: Evaluate service active
TestScript->>Admin: Print PASS or FAIL for service
TestScript->>Shell: Check mount_aznfs command availability
Shell-->>TestScript: Command path or error
TestScript->>TestScript: Evaluate command available
TestScript->>Admin: Print PASS or FAIL for command
TestScript->>Shell: List current aznfs mounts
Shell-->>TestScript: Active aznfs mounts info
TestScript->>TestScript: Count aznfs mounts
TestScript->>Admin: Print PASS or FAIL for active mounts
TestScript->>Admin: Print final summary and exit code
Flow diagram for the aznfs test script logicflowchart TD
A[Start test_aznfs_sh] --> B[Print test header]
B --> C[Check aznfs package installed via package manager]
C -->|installed| D[Print PASS for package]
C -->|not installed| E[Print FAIL for package and set error flag]
D --> F[Check aznfswatchdog service status via systemd]
E --> F
F -->|active| G[Print PASS for aznfswatchdog]
F -->|inactive or missing| H[Print FAIL for aznfswatchdog and set error flag]
G --> I[Check mount_aznfs command availability]
H --> I
I -->|available| J[Print PASS for mount_aznfs]
I -->|not available| K[Print FAIL for mount_aznfs and set error flag]
J --> L[List current aznfs mounts]
K --> L
L --> M[Count active aznfs mounts]
M -->|count >= 0| N[Print PASS with mount count]
N --> O{Any error flag set?}
O -->|no| P[Print all tests passed and exit 0]
O -->|yes| Q[Print failures detected and exit nonzero]
P --> R[End]
Q --> R[End]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
test_aznfs_mountcheck treats anymountentry withtype nfsas an aznfs mount, which can misreport non-aznfs NFS mounts as aznfs; consider tightening the match (e.g., by checking the source, mount options, or helper in/proc/self/mountinfo) or explicitly clarifying that this is only a generic NFS sanity check. - The log messages like "Checking: aznfs package is installed or not" and "Checking: mount.aznfs command is available or not" could be simplified for readability (e.g., "Checking: aznfs package is installed") to keep test output concise and consistent.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `test_aznfs_mount` check treats any `mount` entry with `type nfs` as an aznfs mount, which can misreport non-aznfs NFS mounts as aznfs; consider tightening the match (e.g., by checking the source, mount options, or helper in `/proc/self/mountinfo`) or explicitly clarifying that this is only a generic NFS sanity check.
- The log messages like "Checking: aznfs package is installed or not" and "Checking: mount.aznfs command is available or not" could be simplified for readability (e.g., "Checking: aznfs package is installed") to keep test output concise and consistent.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
cc4f914 to
a049ce8
Compare
| until: __hpc_azure_packages_install is success | ||
|
|
||
|
|
||
| - name: Install package aznfs test script |
There was a problem hiding this comment.
Do users need it? Or it's only for our internal tests?
There was a problem hiding this comment.
@spetrosi thank you so much for review.
Based on my understanding, similar to test-moneo.sh.j2 and test-azure-health-checks.sh.j2, this new test script test-aznfs.sh.j2 might be useful for both users and our internal testing processes.
The question is whether to include an option to enable these test installations in future or simply add these test scripts to simplify the process as current method. As we know, other older packages do not have their specific tests integrated as Ansible scripts yet.
For newly added packages, we have two separate testing tasks:
- Testing package: defining how to test the package, typically by adding the test within an Ansible script.
- Automation: developing the automated test case within the end-to-end (e2e) test repository.
Hi @dgchinner,
Could you please help to check whether I understand the questions about "Do users need it? Or it's only for our internal tests?" correctly? Do we need a overall ansible parameter to control whether need to install test script?
Thank you so much.
Xuemin
Add a test script to validate Azure NFS Mount Helper (aznfs) installation and basic service. This readiness validation is to ensure aznfs is properly installed and ready for use before performing real mount operations, mainly check below items: - aznfs package is installed - aznfswatchdog service is active - mount.aznfs command is available JIRA: RHELHPC-124 Signed-off-by: Xuemin Li <xuli@redhat.com>
a049ce8 to
2bac64d
Compare
Enhancement:
Add a test script to validate Azure NFS Mount Helper (aznfs) installation and basic service.
This readiness validation is to ensure aznfs is properly installed and ready for use before performing real mount operations, mainly check below items:
Reason:
Add aznfs package test
Result:
`bash /opt/hpc/azure/tests/test-aznfs.sh
[2026-02-27 11:41:54] ========================================
[2026-02-27 11:41:54] Azure NFS Mount Helper (aznfs) Test
[2026-02-27 11:41:54] ========================================
[2026-02-27 11:41:54] Test: aznfs package installation...
Checking: aznfs package is installed
[PASS] aznfs package is installed
[2026-02-27 11:41:54] Test: aznfswatchdog status...
Checking: aznfswatchdog service is active
[PASS] aznfswatchdog service is active
[2026-02-27 11:41:54] Test: aznfs mount function...
Checking: mount.aznfs is available
[PASS] mount.aznfs is available
Checking: current aznfs mounts
[PASS] Found 1 active aznfs mount(s)
[2026-02-27 11:41:54] ========================================
[2026-02-27 11:41:54] All tests passed (4)`
Issue Tracker Tickets (Jira or BZ if any):
JIRA: RHELHPC-124
Summary by Sourcery
Tests: