This document explains the test layout and what each group protects.
For the external API behavior these tests help protect, see External API assumptions.
The project uses:
The Catch2 tests are the fastest place to check backend and client behavior.
The test build needs:
pkgconfig(gio-2.0)pkgconfig(catch2-with-main)
On Fedora, catch-devel provides pkgconfig(catch2-with-main).
Key files:
- test/unit/test_backend.cpp
- test/unit/test_config.cpp
- test/unit/test_daemon_upgrade_state.cpp
- test/unit/test_dnf5daemon_client.cpp
- test/unit/test_pending_transaction_action_rows.cpp
- test/unit/test_package_query_cache.cpp
- test/unit/test_package_table_export.cpp
- test/unit/test_package_table_sort.cpp
- test/unit/test_pending_transaction_request.cpp
- test/unit/test_search.cpp
- test/unit/test_transaction_history.cpp
- test/unit/test_transaction_request.cpp
- test/unit/test_offline.cpp
These tests protect:
- package search and merge behavior
- Latest only and all-version package query behavior
- config file parsing and fallback behavior
- installed snapshot behavior
- pending transaction action row selection for install, upgrade, downgrade, remove, and reinstall
- package table CSV export formatting
- package table column text and sorting behavior
- dnf5daemon transaction preview parsing, upgrade-target parsing, and failure handling
- daemon upgrade snapshot ownership, stale-state invalidation, and current-target validation
- transaction history row formatting, action labels, and page cursor behavior
- transaction request validation
- offline and cached metadata behavior
The app now talks to DNF5 dnf5daemon for privileged transactions. Use Docker and native Fedora testing to verify upgrade-target listing, preview, apply, cancel, failure, and session cleanup behavior.
Run the native test suite:
make testRun the offline cached metadata smoke tests separately:
make dockerofflinetestRun the dnf5daemon transaction client tests in Docker:
make dockerdnf5daemontestRun the dnf5daemon transaction client tests on native Fedora:
make dnf5daemontestThe native dnf5daemon tests may install and remove cowsay unless
DNFUI_TEST_DNF5DAEMON_INSTALL_SPEC is set to another package.
The script restores whether the test package was installed before the run.
The optional downgrade preview test runs when
DNFUI_TEST_DNF5DAEMON_DOWNGRADE_SPEC names a safe installed package version
that can be downgraded in the test environment.
Native apply tests are skipped by default because they require dnf5daemon
authorization. Run them explicitly with:
make dnf5daemonapplytestOn a native Fedora test machine, installing dnf5daemon-server-polkit lets the
apply tests run without a desktop authorization prompt.
Without that package, run make dnf5daemonapplytest from the desktop session
where a Polkit authentication agent can show the authorization dialog. Running
the apply target over SSH may fail with Not authorized.
Use a disposable Fedora VM or test machine. Do not use your main system for this test.
Create the local signed test repo:
utils/setup_gpg_key_prompt_test_repo.sh setupRun DNF UI from the branch:
make runSearch for:
dnfui-gpg-test-packageThe key prompt can appear while preparing the preview or while applying the transaction. Both paths must ask before trusting the key.
Reject test:
- Click
Rejectin the DNF UI key prompt. - The transaction should fail.
- The package should not be installed.
utils/setup_gpg_key_prompt_test_repo.sh statusshould not list an imported test key.
Close test:
- Start the same transaction in DNF UI again.
- Close the DNF UI key prompt without trusting the key.
- The package should not be installed.
utils/setup_gpg_key_prompt_test_repo.sh statusshould not list an imported test key.
The Apply progress window is not user-cancellable. Cancellation after UI approval but before daemon confirmation is covered by a unit test.
Run utils/setup_gpg_key_prompt_test_repo.sh restore before the accept test.
Accept test:
- Run
utils/setup_gpg_key_prompt_test_repo.sh setup. - Start the same transaction in DNF UI again.
- Click
Trust Keyin the DNF UI key prompt. - The transaction should continue.
utils/setup_gpg_key_prompt_test_repo.sh statusshould show the package and imported test key.
Restore the disposable test machine:
utils/setup_gpg_key_prompt_test_repo.sh restoreRun the Docker app target with networking disabled:
DOCKER_NETWORK_MODE=none make dockerrunRun the Docker app target with the Swedish translation:
LANG=sv_SE.UTF-8 LANGUAGE=sv make dockerrun
CONTAINER_RUNTIME=podman LANG=sv_SE.UTF-8 LANGUAGE=sv make dockerrunThe Makefile is a task runner. Meson owns build configuration and test definitions.
Run a quick smoke test under Valgrind Memcheck:
make memcheckRun the desktop app under Valgrind Memcheck:
make memcheck-appMemcheck logs are written under build/memcheck/.
The default Memcheck setup fails on definite and indirect leaks from this
project. Reachable and possible leak noise from GLib, GTK, DNF, and related
libraries is suppressed in utils/valgrind-dnfui.supp.
Useful options:
MEMCHECK_SMOKE_FILTER="Transaction request validation rejects an empty request" make memcheck
MEMCHECK_SMOKE_TIMEOUT=5m make memcheck
MEMCHECK_SMOKE_TIMEOUT=10m make memcheckUse this before releases that change package table storage, package query workers, all-version listing, or List Upgradable row handling:
- Start DNF UI and record process memory after the first window is idle:
pid="$(pgrep -n dnfui)"
grep -E 'Rss|Pss|Private' "/proc/$pid/smaps_rollup"- Run
List Packagesten times, waiting for each run to finish before recording memory again. - Repeat with
List Installed, a broadSearch, andList Upgradable. - Repeat Search and List Packages with Latest only disabled.
- Alternate Latest only and all-version searches to verify all-version rows do not accumulate outside the visible table.
- Alternate
List UpgradableandList Packagesa few times to verify old daemon-backed rows are released. - A high but stable value is acceptable. Continued substantial growth after every completed run is a release blocker.
- Run
make memcheck-apponce if memory keeps growing or if table row ownership changed.
make dockerrunstarts a system bus in the container and uses dnf5daemonmake dockerdnf5daemontestruns upgrade-target listing, preview, downgrade preview when configured, apply, remove, reinstall, and failure checks against dnf5daemon- The dnf5daemon failure checks include applying a prepared session after another session changed package state. The stale prepared session must fail and remain releasable.
- Use native Fedora to test the real desktop Polkit prompt
Fedora package review expects rpmlint output for the source RPM and all binary
RPMs produced by the build. It is also normal to check that the source RPM builds
in mock.
Build RPMs with the Make targets and run rpmlint:
make srpm
make rpm
rpmlint dnf-ui-latest.src.rpm rpmbuild/RPMS/*/*.rpmKeep the rpmlint output so it can be included in the Fedora package review.
Build the source RPM in a clean Fedora build environment:
mock -r fedora-rawhide-x86_64 --rebuild dnf-ui-latest.src.rpmUse the Fedora release and architecture that match the package review you are
preparing. Running mock may require the user to be a member of the mock
group.
Reference: https://docs.fedoraproject.org/en-US/packaging-guidelines/ReviewGuidelines/
For documentation-only changes, run git diff --check.
For comments inside C++ source files, also run a target that compiles the changed files.
For backend query changes, run the relevant Catch2 tests.
For transaction changes, test the dnf5daemon Docker path and then verify apply behavior on native Fedora with a real desktop Polkit prompt.
For package apply behavior, use test packages that are safe to install and remove in the test environment.
Use these checks after changes to Latest only, package queries, package table display, or pending action identity:
- Start with Latest only enabled.
- Run Search and List Packages and verify the compact one-row-per-package view.
- Disable Latest only and run the same query again.
- Verify that distinct exact NEVRAs can appear as separate rows.
- Verify that duplicate repository copies of the same exact NEVRA are hidden.
- Verify that older repository versions show
Older in repository. - Verify that intermediate newer versions can be selected for Details but cannot be marked for upgrade.
- Verify that the newest available version remains the only normal upgrade target.
- Verify that downgradeable rows mark a pending downgrade using the selected exact NEVRA.
- Verify that removing or reinstalling one exact installed NEVRA does not change pending actions for another installed NEVRA with the same name and architecture.
- Verify that List Installed, List Upgradable, Upgrade All, and Mark Listed Upgrades do not depend on the Latest only checkbox.