teemtee / tmt

Test Management Tool
MIT License
82 stars 123 forks source link

[FR] specify `ref` as "a branch I am on" #3232

Open befeleme opened 2 weeks ago

befeleme commented 2 weeks ago

I want to run tmt tests on a component python-sphinx-theme-alabaster for c10s branch of the centos stream dist git repository. The tests are stored in another component - python-sphinx. I can use url: in the discover step to pull them. This doesn't work yet, because the default branch is used (in my case: c9s). I want to set the branch to the correct one. I can use ref: for that and specify the value to c10s. That works. When c11s is created, I will have to manually change all the files. When I want to run the tests in different Fedoras, I'll have to manually specify the branches. I would like to have it possible to define ref as "a value of the branch I am currently on", so if I open a PR to c10s, tmt will look for the corresponding value in a remote repository.

The docs say:

Additionally, one can set ref dynamically. This is possible using a special file in tmt format stored in the default branch of a tests repository.
This special file should contain rules assigning attribute ref in an adjust block, for example depending on a test run context.

The thing is, I don't really want to rely on the "default" branch, because that one can be switched to a different one in time.

Does there exist a solution for this? Would you be willing to add one?

hroncok commented 2 weeks ago

Note that Fedora and CentOS have different dist-git URLs, so this won't allow us to fork the tests from Fedora without adjustments, but at least the tests would fail (searching for c10s in Fedora distgit) instead of running something bad.

Ideally, if this is solved, the next step would be to be able to set url to something like {distgit pkgname}.