Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f57cef0

Browse files
committedJun 18, 2024··
ci(tmt): run the tests on Testing Farm
Signed-off-by: Matej Focko <[email protected]>
1 parent 3531669 commit f57cef0

8 files changed

+125
-0
lines changed
 

‎.fmf/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

‎.packit.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
packit_instances: ["prod", "stg"]
3+
4+
packages:
5+
packit-service:
6+
downstream_package_name: packit-service
7+
upstream_package_name: packit-service
8+
upstream_project_url: https://github.com/packit/packit-service
9+
paths:
10+
- ./
11+
specfile_path: none.spec
12+
13+
issue_repository: https://github.com/packit/packit-service
14+
15+
actions:
16+
pre-sync:
17+
# FMF has to be installed on system where you are calling this tool.
18+
- python3 plans/git_reference.py
19+
20+
srpm_build_deps: []
21+
22+
jobs:
23+
- job: tests
24+
trigger: pull_request
25+
targets:
26+
- epel-9
27+
skip_build: true
28+
tf_extra_params:
29+
environments:
30+
# to run the container specified in the tests
31+
- os: null
32+
packages:
33+
- packit-service

‎.pre-commit-config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,7 @@ repos:
128128
- LICENSE_HEADER.txt
129129
- --comment-style
130130
- "#"
131+
- repo: https://github.com/teemtee/tmt.git
132+
rev: 1.29.0
133+
hooks:
134+
- id: tmt-lint

‎plans/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Run tests locally:
2+
3+
$ tmt -v run -a provision -h local
4+
5+
Run tests in a container using podman:
6+
7+
$ sudo dnf install tmt-provision-container
8+
$ tmt -v run -a provision -h container
9+
10+
For more info see:
11+
12+
- https://packit.dev/docs/testing-farm/
13+
- [tmt @ DevConf 2021 slides](https://static.sched.com/hosted_files/devconfcz2021/37/tmt-slides.pdf)
14+
- [fmf docs](https://fmf.readthedocs.io)
15+
- [tmt docs](https://tmt.readthedocs.io)

‎plans/full.fmf

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
summary: Unit, integration & functional tests.
2+
3+
discover+:
4+
filter: tag:full
5+
6+
provision:
7+
how: container
8+
image: quay.io/packit/packit-service-tests:stg

‎plans/git_reference.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/python
2+
3+
# Copyright Contributors to the Packit project.
4+
# SPDX-License-Identifier: MIT
5+
6+
import subprocess
7+
from pathlib import Path
8+
9+
import fmf
10+
11+
tree_root = Path.cwd().absolute()
12+
node = fmf.Tree(tree_root).find("/plans")
13+
with node as data:
14+
data["discover"]["url"] = "https://github.com/packit/packit-service.git"
15+
data["discover"]["ref"] = (
16+
subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()
17+
)

‎plans/main.fmf

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
discover:
2+
how: fmf
3+
4+
execute:
5+
how: tmt

‎tests/full.fmf

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
summary:
2+
Full test suite of the Packit Service
3+
4+
component:
5+
- packit-service
6+
tier: 1
7+
tag:
8+
- full
9+
10+
adjust+:
11+
- when: initiator == packit
12+
environment+:
13+
COLOR: "no"
14+
CONTAINER_RUN_INTERACTIVE: ""
15+
16+
path: /
17+
test: 'make check "TEST_TARGET=$TEST_TARGET"'
18+
duration: 30m
19+
20+
/custom-target:
21+
summary: Custom tests
22+
description: |
23+
Custom tests that are useful for debugging as it is much easier to override
24+
the ‹TEST_TARGET› environment variable, disabled in CI as it is split into
25+
the separate test suites.
26+
tag: manual
27+
adjust:
28+
- when: initiator != human
29+
enabled: false
30+
because: "This test suite is for manually specifying the target and to be run locally"
31+
32+
/unit:
33+
summary: Unit tests
34+
order: 1
35+
environment+:
36+
TEST_TARGET: tests/unit/
37+
38+
/integration:
39+
summary: Integration tests
40+
order: 2
41+
environment+:
42+
TEST_TARGET: tests/integration/

0 commit comments

Comments
 (0)
Please sign in to comment.