Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Packit/TMT to run Python-based udev tests #3447

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
155 changes: 0 additions & 155 deletions .github/workflows/python.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
- dependencies: black python3-isort
task: make -f Makefile fmt-ci
working-directory: ./tests/client-dbus
- dependencies: yamllint
task: make -f Makefile yamllint
- dependencies: yamllint tmt
task: make -f Makefile yamllint tmtlint
working-directory: .
runs-on: ubuntu-22.04
container: fedora:38 # CURRENT DEVELOPMENT ENVIRONMENT
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
- dependencies: black python3-isort
task: make -f Makefile fmt-ci
working-directory: ./tests/client-dbus
- dependencies: yamllint
task: make -f Makefile yamllint
- dependencies: yamllint tmt
task: make -f Makefile yamllint tmtlint
working-directory: .
- dependencies: shfmt
task: make -f Makefile fmt-shell-ci
Expand Down
6 changes: 5 additions & 1 deletion .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ srpm_build_deps:
jobs:
- job: copr_build
trigger: pull_request
manual_trigger: true
targets:
- fedora-stable

- job: tests
trigger: pull_request
targets:
- fedora-stable
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ test-stratis-min:
yamllint:
yamllint --strict .github/workflows/*.yml .packit.yaml

## Run tmt lint
tmtlint:
tmt lint

## Build docs-rust for CI
docs-ci: docs-rust

Expand Down Expand Up @@ -507,6 +511,7 @@ clippy: clippy-macros clippy-min clippy-udev-utils clippy-no-ipc
test-clevis-loop-should-fail-valgrind
test-clevis-real
test-clevis-real-should-fail
tmtlint
yamllint

# COLORS
Expand Down
18 changes: 18 additions & 0 deletions plans/all.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
summary: top level management
prepare:
- name: Install packages
how: install
package:
- tang
- systemd
- name: Start tang server
how: shell
script: systemctl enable tangd.socket --now
- name: Reload udev
how: shell
script: udevadm control --reload
discover:
how: fmf
execute:
how: tmt
exit-first: false
12 changes: 12 additions & 0 deletions test/loop/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
summary: Run tests that use loopbacked device framework
duration: 20m
require:
- clevis-luks
- make
- python3-dbus
- python3-dbus-client-gen
- python3-dbus-python-client-gen
- python3-psutil
- python3-pyudev
test: TANG_URL=localhost RUST_LOG=stratisd=debug STRATISD=/usr/libexec/stratisd STRATIS_DUMPMETADATA=/usr/bin/stratis-dumpmetadata PYTHONPATH=./src make -f Makefile tang-tests dump-metadata-tests
path: /tests/client-dbus
12 changes: 12 additions & 0 deletions test/udev/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
summary: Run udev tests
duration: 20m
require:
- clevis-luks
- make
- python3-dbus
- python3-dbus-client-gen
- python3-dbus-python-client-gen
- python3-psutil
- python3-pyudev
test: TANG_URL=localhost RUST_LOG=stratisd=debug STRATISD=/usr/libexec/stratisd STRATIS_DUMPMETADATA=/usr/bin/stratis-dumpmetadata PYTHONPATH=./src make -f Makefile udev-tests
path: /tests/client-dbus
90 changes: 0 additions & 90 deletions tests/client-dbus/tests/misc/test_startup.py

This file was deleted.

13 changes: 13 additions & 0 deletions tests/client-dbus/tests/udev/_loopback.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,21 @@ def create_devices(self, number):
Note: The first time a loop back device is known it will generate
a udev "add" event, subsequent backing file changes do not, thus we
will need to generate it synthetically.
If this is the absolute first time calling losetup for this sequence,
make an extra loop device and skip the first loop device created.
:param int number: the number of devices to create
:return: list of keys for the devices
:rtype: list of uuid.UUID
"""
tokens = []

first_creation = self.count == 0

if first_creation:
number = number + 1

for _ in range(number):
backing_file = os.path.join(self.dir, f"block_device_{self.count}")
self.count += 1
Expand All @@ -119,6 +129,9 @@ def create_devices(self, number):
self.devices[token] = (device, backing_file)
tokens.append(token)

if first_creation:
tokens = tokens[1:]

self._wait_for_udev(tokens)
self.generate_synthetic_udev_events(tokens, UDEV_ADD_EVENT)
return tokens
Expand Down