diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index 9093ace2a..f4054b9fa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ vendor/ src/proto-build/netavark_proxy.rs contrib/systemd/*/*.service .vscode* +rpm/RPMS +rpm/SRPMS +rpm/*.tar.gz diff --git a/.packit.yaml b/.packit.yaml index abbfa15e6..6578ed72e 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -24,9 +24,9 @@ jobs: - job: copr_build trigger: pull_request packages: [netavark-fedora] - notifications: &copr_build_failure_notification - failure_comment: - message: "Ephemeral COPR build failed. @containers/packit-build please check." + #notifications: &copr_build_failure_notification + # failure_comment: + # message: "Ephemeral COPR build failed. @containers/packit-build please check." targets: fedora-all-x86_64: {} fedora-all-aarch64: {} @@ -41,8 +41,8 @@ jobs: - job: copr_build trigger: pull_request packages: [netavark-centos] - notifications: *copr_build_failure_notification - targets: + #notifications: *copr_build_failure_notification + targets: ¢os_targets - centos-stream-9-x86_64 - centos-stream-9-aarch64 - centos-stream-10-x86_64 @@ -52,8 +52,8 @@ jobs: - job: copr_build trigger: pull_request packages: [netavark-rhel] - notifications: *copr_build_failure_notification - targets: + #notifications: *copr_build_failure_notification + targets: &rhel_targets - epel-9-x86_64 - epel-9-aarch64 enable_net: true @@ -70,6 +70,51 @@ jobs: project: podman-next enable_net: true + - job: tests + trigger: pull_request + packages: [netavark-fedora] + #notifications: + #failure_comment: + # message: "TMT tests failed. @containers/packit-build please check." + targets: + - fedora-all + tf_extra_params: + environments: + - artifacts: + - type: repository-file + id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/fedora-$releasever/rhcontainerbot-podman-next-fedora-$releasever.repo + + - job: tests + trigger: pull_request + packages: [netavark-centos] + #notifications: + #failure_comment: + # message: "TMT tests failed. @containers/packit-build please check." + targets: *centos_targets + tf_extra_params: + environments: + - artifacts: + - type: repository-file + id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/centos-stream-$releasever/rhcontainerbot-podman-next-centos-stream-$releasever.repo + + - job: tests + trigger: pull_request + packages: [netavark-rhel] + #notifications: + #failure_comment: + # message: "TMT tests failed. @containers/packit-build please check." + targets: + epel-9-x86_64: + distros: [RHEL-9.4.0-Nightly,RHEL-9-Nightly] + epel-9-aarch64: + distros: [RHEL-9.4.0-Nightly,RHEL-9-Nightly] + use_internal_tf: true + tf_extra_params: + environments: + - artifacts: + - type: repository-file + id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/epel-$releasever/rhcontainerbot-podman-next-epel-$releasever.repo + # Sync to Fedora - job: propose_downstream trigger: release diff --git a/Makefile b/Makefile index 6b9b7d9bc..955847999 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,13 @@ unit: $(CARGO_TARGET_DIR) $(CARGO) test .PHONY: integration +# The NETAVARK envvar is used by bats to specify path to a netavark binary. +ifdef NETAVARK +$(info Skipping build as NETAVARK binary is specified) +integration: $(CARGO_TARGET_DIR) +else integration: $(CARGO_TARGET_DIR) examples +endif # needs to be run as root or with podman unshare --rootless-netns bats test/ bats test-dhcp/ diff --git a/plans/all.fmf b/plans/all.fmf new file mode 100644 index 000000000..4b754d2da --- /dev/null +++ b/plans/all.fmf @@ -0,0 +1,20 @@ +discover: + how: fmf +execute: + how: tmt + +/upstream: + summary: Run tests on upstream PRs + discover+: + filter: tag:upstream + adjust+: + enabled: false + when: initiator is not defined or initiator != packit + +/downstream: + summary: Run tests on bodhi / errata and dist-git PRs + discover+: + filter: tag:downstream + adjust+: + enabled: false + when: initiator == packit diff --git a/test/tmt/main.fmf b/test/tmt/main.fmf new file mode 100644 index 000000000..5fe6c417d --- /dev/null +++ b/test/tmt/main.fmf @@ -0,0 +1,25 @@ +# Only common dependencies that are NOT required to run test_integration.sh are +# specified here. Everything else is in test_integration.sh. +require: + - cargo + - make + - protobuf-compiler + +adjust: + duration: 10m + when: arch == aarch64 + +/validate: + tag: upstream + summary: Validate test + test: make -C ../.. validate + +/unit: + tag: upstream + summary: Unit test + test: make -C ../.. unit + +/integration: + tag: [ upstream, downstream ] + summary: Integration tests + test: bash test_integration.sh diff --git a/test/tmt/test_integration.sh b/test/tmt/test_integration.sh new file mode 100644 index 000000000..a5ea489aa --- /dev/null +++ b/test/tmt/test_integration.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -exo pipefail + +cat /etc/redhat-release + +# Remove testing-farm repos if they exist because they interfere with the +# podman-next copr. The default distro repos will not be removed and can be +# used wherever relevant. +rm -f /etc/yum.repos.d/tag-repository.repo + +# Install dependencies for running tests +dnf -y install \ + bats \ + bind-utils \ + cargo \ + clippy \ + dbus-daemon \ + firewalld \ + go-md2man \ + iptables \ + jq \ + make \ + nftables \ + nmap-ncat \ + rustfmt + +rpm -q aardvark-dns cargo netavark + +# Run tests +make -C ../.. NETAVARK=/usr/libexec/podman/netavark integration