Skip to content

Commit 3781fdd

Browse files
committed
TMT: Run integration and unit tests
Include system and integration tests in the same file, get rid of tags and filter by plan name. Adjust names and identifiers for consistency. Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent b9e3a31 commit 3781fdd

File tree

8 files changed

+160
-48
lines changed

8 files changed

+160
-48
lines changed

.packit.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,39 @@ jobs:
4848
targets: *test_targets
4949
tmt_plan: "/plans/system/rootless-remote"
5050
identifier: "sys-remote-rootless"
51+
52+
- job: tests
53+
trigger: pull_request
54+
skip_build: true
55+
use_internal_tf: true
56+
notifications: *packit_failure_notification
57+
targets: *test_targets
58+
tmt_plan: "/plans/integration/rootless-local"
59+
identifier: "int-local-rootless"
60+
61+
- job: tests
62+
trigger: pull_request
63+
skip_build: true
64+
use_internal_tf: true
65+
notifications: *packit_failure_notification
66+
targets: *test_targets
67+
tmt_plan: "/plans/integration/root-remote"
68+
identifier: "int-remote-root"
69+
70+
- job: tests
71+
trigger: pull_request
72+
skip_build: true
73+
use_internal_tf: true
74+
notifications: *packit_failure_notification
75+
targets: *test_targets
76+
tmt_plan: "/plans/integration/rootless-remote"
77+
identifier: "int-remote-rootless"
78+
79+
- job: tests
80+
trigger: pull_request
81+
skip_build: true
82+
use_internal_tf: true
83+
notifications: *packit_failure_notification
84+
targets: *test_targets
85+
tmt_plan: "/plans/localunit"
86+
identifier: "unit"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ run-docker-py-tests:
647647
rm -f test/__init__.py
648648

649649
.PHONY: localunit
650-
localunit: test/goecho/goecho test/version/version
650+
localunit: .install.ginkgo test/goecho/goecho test/version/version
651651
rm -rf ${COVERAGE_PATH} && mkdir -p ${COVERAGE_PATH}
652652
UNIT=1 $(GINKGO) \
653653
-r \

pkg/machine/qemu/command/qemu_command_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ import (
77
"testing"
88

99
"github.com/containers/podman/v5/pkg/machine/define"
10+
. "github.com/containers/podman/v5/test/utils"
1011
"github.com/stretchr/testify/assert"
1112
"github.com/stretchr/testify/require"
1213
)
1314

1415
func TestQemuCmd(t *testing.T) {
16+
host := GetHostDistributionInfo()
17+
if host.Distribution == "rhel" || host.Distribution == "centos" && host.Distribution != "fedora" {
18+
t.Skip("Skip QEMU tests on RHEL and CentOS Stream")
19+
}
20+
1521
ignFile, err := define.NewMachineFile(t.TempDir()+"demo-ignition-file.ign", nil)
1622
assert.NoError(t, err)
1723

plans/integration.fmf

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
discover:
2+
how: fmf
3+
4+
execute:
5+
how: tmt
6+
7+
prepare:
8+
- name: build and test dependencies
9+
how: install
10+
package:
11+
- aardvark-dns
12+
- go-md2man
13+
- golang
14+
- gpgme-devel
15+
- libseccomp-devel
16+
- netavark
17+
- podman-catatonit
18+
# podman-tests used only to fetch test dependencies
19+
- podman-tests
20+
- slirp4netns
21+
- systemd-devel
22+
order: 5
23+
- how: shell
24+
script: modprobe null_blk nr_devices=1
25+
order: 5
26+
27+
provision:
28+
how: artemis
29+
hardware:
30+
memory: ">= 16 GB"
31+
cpu:
32+
cores: ">= 4"
33+
threads: ">=8"
34+
disk:
35+
- size: ">= 512 GB"
36+
37+
/root-local:
38+
summary: Local rootful integration tests
39+
discover+:
40+
test: /test/tmt/int-root-local
41+
42+
/rootless-local:
43+
summary: Local rootless integration tests
44+
discover+:
45+
test: /test/tmt/int-rootless-local
46+
47+
/root-remote:
48+
summary: Remote rootful integration tests
49+
discover+:
50+
test: /test/tmt/int-root-remote
51+
52+
/rootless-remote:
53+
summary: Remote rootless integration tests
54+
discover+:
55+
test: /test/tmt/int-rootless-remote

plans/localunit.fmf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
summary: Run unit tests
2+
3+
discover:
4+
how: fmf
5+
test: /test/tmt/localunit
6+
7+
execute:
8+
how: tmt
9+
10+
prepare:
11+
- name: build and test dependencies
12+
how: install
13+
package:
14+
- golang
15+
- gpgme-devel
16+
- libseccomp-devel
17+
- systemd-devel
18+
order: 5
19+
20+
provision:
21+
how: artemis
22+
hardware:
23+
memory: ">= 16 GB"
24+
cpu:
25+
cores: ">= 4"
26+
threads: ">=8"
27+
disk:
28+
- size: ">= 512 GB"

plans/system.fmf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ provision:
5353
- size: ">= 512 GB"
5454

5555
/root-local:
56-
summary: Local root system tests
56+
summary: Local rootful system tests
5757
discover+:
5858
test: /test/tmt/sys-root-local
5959

@@ -63,7 +63,7 @@ provision:
6363
test: /test/tmt/sys-rootless-local
6464

6565
/root-remote:
66-
summary: Remote root system tests
66+
summary: Remote rootful system tests
6767
discover+:
6868
test: /test/tmt/sys-root-remote
6969

test/tmt/main.fmf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,35 @@ adjust+:
3535
chown -R $ROOTLESS_USER $TMT_TREE &&
3636
su - "$ROOTLESS_USER" -c "CI_DESIRED_NETWORK=netavark make -C $TMT_TREE remotesystem"
3737
duration: 40m
38+
39+
/int-root-local:
40+
test: >
41+
bash ./setup.sh &&
42+
make -C $TMT_TREE localintegration
43+
duration: 40m
44+
45+
/int-rootless-local:
46+
test: >
47+
bash ./setup.sh &&
48+
loginctl enable-linger $ROOTLESS_USER &&
49+
chown -R $ROOTLESS_USER $TMT_TREE &&
50+
su - "$ROOTLESS_USER" -c "make -C $TMT_TREE localintegration"
51+
duration: 40m
52+
53+
/int-root-remote:
54+
test: >
55+
bash ./setup.sh &&
56+
make -C $TMT_TREE remoteintegration
57+
duration: 40m
58+
59+
/int-rootless-remote:
60+
test: >
61+
bash ./setup.sh &&
62+
loginctl enable-linger $ROOTLESS_USER &&
63+
chown -R $ROOTLESS_USER $TMT_TREE &&
64+
su - "$ROOTLESS_USER" -c "make -C $TMT_TREE remoteintegration"
65+
duration: 40m
66+
67+
/localunit:
68+
test: make -C $TMT_TREE localunit
69+
duration: 40m

test/tmt/system.fmf

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)