The rust tests
  • Shell 82.1%
  • Rust 12.5%
  • JavaScript 5.4%
Find a file
Jesus Checa Hidalgo 78a9ec15fc net_err_suggests_fetch_with_cli: fix false positives
Some test systems have catch-all DNS resolvers that point
needs-proxy.invalid to loopback, resulting in a connection refused OS
error instead the expected Net error. This change uses a known invalid
IP to bypass any potential DNS, and also adds an extremely short timeout
to enforce a Net error.

Also make the test pattern matching a bit more fuzzy to avoid future
false positives.

Remove the standalone Cargo.toml file and integrate it into the main
script to be able to parametrize it.
2026-04-07 07:48:50 +00:00
.fmf Bring tests from rpms/rust repo 2024-06-13 18:04:39 +02:00
plans Add tmt plan to run all local tests 2024-06-14 12:43:03 +02:00
tests net_err_suggests_fetch_with_cli: fix false positives 2026-04-07 07:48:50 +00:00
.pre-commit-config.yaml Add basic pre-commit config 2024-06-13 18:00:50 +02:00
README.md Add tmt tests documentation 2024-06-13 17:59:13 +02:00

Rust Tests

This repository contains tests for rust packages. These tests are meant to be run on bodhi updates or Pull Requests.

Usage

Tests are executed using TMT (Test Management Tool). The repository includes a TMT plan that runs all the tests by default. All the tests support (and expect) the following context dimensions:

  • distro
  • arch
  • collection (only applicable to RHEL 7)

To run the tests:

# Run in the default virtual environment
tmt -c distro=<distro> -c arch=<arch> run -avv

# Run on a scheduled system
tmt -c distro=<distro> -c arch=<arch> run -avv provision -h connect -g <ip_or_hostname>

# Run specific tests
tmt -c distro=<distro> -c arch=<arch> run -avv provision -h connect -g <ip_or_hostname> test -n <regex>

Adding New Tests

Please consider the following when adding new tests:

  • Test scripts must be named runtest.sh.
  • Prefer using beakerlib tests over shell tests. If using a shell test cannot be avoided, the main.fmf file must redefine/overwrite the framework key by adding framework: shell.
  • Tests must be placed in tests/<category>/<test-name>/, where <category> can be Regression, Sanity, Security, or a new one if required.
  • This repository has a common configuration under tests/main.fmf, inherited by all tests. When adding new ones, be careful not to overwrite existing keys from the inherited tests/main.fmf.

Templates

Use the following templates when creating new tests.

FMF template. Uncomment needed fields, remove the rest.

summary: Descriptive summary for the test
duration: 2m
tier: 1
# Add an additional contact(s) if applicable
# contact+:
#   - Somebody <somebody@redhat.com>
# Additional requires
# require+:
#   - rpm-build
# Adjustments based on context dimensions
# adjust+:
#   - when: collection is defined
#     enabled: false
#     because: Test not supported in collections
# link+:
#   - verifies: https://issues.redhat.com/browse/...
# tag+:
#   - sometag

Script template:

# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1

# Define package name(s) for rlAssertRpm to report installed versions
PACKAGE=$(rpm -qf $(which rustc))
PACKAGES=${PACKAGES:-$PACKAGE}

rlJournalStart
    rlPhaseStartSetup
        rlAssertRpm --all
        # Any additional setup steps.
        # ....

        rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
        rlRun "pushd $TmpDir"
    rlPhaseEnd

    rlPhaseStartTest
        # Your actual test goes here
    rlPhaseEnd

    rlPhaseStartCleanup
        rlRun "popd"
        rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
    rlPhaseEnd
rlJournalEnd