ruby/plans.fmf
Jun Aruga 3d9a2be436 Add a dummy plan and test to make CI pass on no tests selected.
The plan "modified" selects only the tests that were edited relative to the
reference branch. However, when a pull-request has only changed files such as
`README.md`, the tmt's modified plan's discover process doesn't detect any tests,
showing "summary: 0 tests selected" and tmt exits as exit status 3. And Fedora
CI fails marking failure.

Below is the tmt command to emulate the case of "0 tests selected" before this
change.

tmt trigger:
https://tmt.readthedocs.io/en/stable/spec/context.html#trigger

```
$ rpm -q tmt
tmt-1.67.0-1.fc43.noarch

$ tmt -c distro=fedora-rawhide -c trigger=commit run -a \
  provision -h virtual -i fedora-rawhide
/var/tmp/tmt/run-065

/plans/modified
    discover
        directory: /home/jaruga/var/pkg/fed/tests/ruby
        how: fmf
        modified-url: https://src.fedoraproject.org/tests/ruby
        modified-ref: reference/main
        summary: 0 tests selected
        warning: No tests found, finishing plan.

total: no results found

$ echo $?
3
```

Here is the case.
https://src.fedoraproject.org/tests/ruby/pull-request/35#comment-304383

This commit is to add a dummy plan and test which always runs a test in
addition to the plan "modified" to make CI pass in the case of the 0 tests
selected in the fmf tests.

Note that the plan "modified" is still selected in CI which defines the context
variable `trigger` with value `commit` after this change.

Note there are the following tickets to solve this issue, to pass CI on no
tests selected in the upstream tmt and Fedora Forge which is a coming successor
of Fedora Package Sources powered by Pagure.

So, this commit is a temporary workaround until this issue is solved by
these projects.

* Upstream tmt: https://github.com/teemtee/tmt/issues/4550
* Fedora Forge: https://forge.fedoraproject.org/ci/tickets/issues/542
2026-03-03 21:08:36 +00:00

39 lines
766 B
Text

/:
inherit: false
execute:
how: tmt
/modified:
summary: Run only modified tests in CI.
enabled: false
adjust:
# https://tmt.readthedocs.io/en/stable/spec/context.html#trigger
- when: trigger == commit
enabled: true
discover:
how: fmf
modified-only: true
modified-ref: reference/main
modified-url: https://src.fedoraproject.org/tests/ruby
/all:
summary: Run all the tests.
adjust:
# Don't trigger this plan in CI.
- when: trigger == commit
enabled: false
discover:
how: fmf
/dummy:
summary: Run a dummy test to make CI pass on no tests selected.
enabled: false
adjust:
- when: trigger == commit
enabled: true
discover:
how: shell
tests:
- name: /dummy
test: echo dummy