This document provides testing procedures for the LiveReduce RPM package.
The LiveReduce RPM package includes proper systemd scriptlets and user/group requirements according to Fedora packaging guidelines. This testing suite helps validate these requirements locally.
test/rpm/
├── build_and_test.sh # Main orchestrator for local testing
├── quick_check.sh # Fast spec file validation (runs in CI)
├── setup_test_environment.sh # One-time environment setup
└── README.md # This file
Note: Docker-based RPM building and testing is handled by the CI workflow. See .github/workflows/actions.yml and the Dockerfile in the project root.
- Set up your environment (one-time setup):
./test/rpm/setup_test_environment.shThis will:
- Install build dependencies from the spec file using
dnf builddep - Install
rpmdevtools - Create required users and groups (
snsdata,users,hfiradmin)
- Build the RPM locally:
./rpmbuild.sh- Quick validation:
./test/rpm/quick_check.shThe CI workflow (.github/workflows/actions.yml) automatically:
- Runs
quick_check.shto validate the spec file - Builds the RPM in an isolated Docker container (using
Dockerfile) - Installs the RPM and verifies basic functionality
- Runs systemd dry-run tests (
systemctl --dry-run enable/disable)
Note: Additional static analysis with rpmlint is being added in a separate PR.
- Fedora/RHEL/CentOS 8+ with DNF package manager
- Sudo access for installing packages and creating users/groups
The setup_test_environment.sh script will install everything needed, but you can also manually run:
# Install build dependencies from spec file
sudo dnf builddep -y ./livereduce.spec
# Install additional tools
sudo dnf install -y rpmdevtoolsThe following are required by the RPM:
- User:
snsdata - Groups:
users,hfiradmin
These are created by setup_test_environment.sh or on production systems when the RPM is installed.
Fast validation of spec file requirements:
- Checks for required BuildRequires (
systemd-rpm-macros) - Validates user/group dependencies
- Verifies systemd scriptlet sections exist
- Ensures service file requirements are declared
Usage:
./test/rpm/quick_check.shCI Integration: This runs automatically in the rpm-quick-check CI job.
Orchestrates local RPM building and testing:
- Uses the existing
rpmbuild.shscript - Builds the RPM package
- Runs basic validation
Usage:
./test/rpm/build_and_test.shOn SNS systems (like ndav), the typical workflow is:
# 1. Build the RPM
./rpmbuild.sh
# 2. Install it (if needed for testing)
sudo dnf install -y ~/rpmbuild/RPMS/noarch/python-livereduce-*.rpm
# 3. Test the service
sudo systemctl enable livereduce.service
sudo systemctl start livereduce.service
systemctl status livereduce.service
# 4. Check logs
tail -f /var/log/SNS_applications/livereduce.log
# 5. Stop and remove (if needed)
sudo systemctl stop livereduce.service
sudo systemctl disable livereduce.service
sudo dnf remove -y python-livereduceThe .github/workflows/actions.yml currently includes:
- rpm-quick-check: Validates spec file requirements
- python-build: Builds source distribution with pixi
- rpm: Full Docker-based RPM build and installation test
Note: Additional jobs like rpmlint for static analysis are being added in separate PRs.
The Dockerfile in the project root:
- Uses Red Hat UBI9 as the base image
- Installs EPEL and build tools
- Creates required users and groups
- Uses
dnf builddepto install dependencies from spec file - Builds and installs the RPM
- Runs systemd dry-run tests
- Cause: systemd hasn't reloaded unit files
- Solution:
sudo systemctl daemon-reload
- Cause: Missing user/group or incorrect permissions
- Solution: Run
./test/rpm/setup_test_environment.shor verifysnsdatauser exists
- Cause: Missing build dependencies
- Solution:
sudo dnf builddep -y ./livereduce.spec
# Check RPM dependencies (use -p to check the .rpm file before installing)
rpm -qRp python-livereduce*.rpm
# Verify installation (use -p to check the .rpm file before installing)
rpm -Vp python-livereduce*.rpm
# Check service status
systemctl status livereduce.service
# View service logs
journalctl -u livereduce.service --no-pager- The RPM requires
nsd-app-wrapwhich is SNS-specific and not available in public repositories - For CI testing, the RPM is installed with
rpm -ivh --nodepsto bypass unavailable dependencies - The service file is validated with
systemctl --dry-runtests in CI - Log files go to
/var/log/SNS_applications/livereduce.logwhen run assnsdata, or to the current directory otherwise