teemtee / tmt

Test Management Tool
MIT License
80 stars 122 forks source link

Local library needs to be from git repo #1355

Open lukaszachy opened 2 years ago

lukaszachy commented 2 years ago

I've tried to write test for beakerlib libraries following usual structure with dedicated 'data' directory containing inner fmf root. So I've used main.fmf of the test as

require:
- path: .
  name: /Libary/demo

However it looks that 'url' is required as tmt fails with

discover
    workdir: /var/tmp/tmt/run-317/plans/default/discover
        how: fmf
        Run command 'git rev-parse --show-toplevel'.
        out: /home/lzachar/gits/tmt
        directory: /home/lzachar/gits/tmt/tests/libraries/recursion/data
        Copy '/home/lzachar/gits/tmt/tests/libraries/recursion/data' to '/var/tmp/tmt/run-317/plans/default/discover/default/tests'.
        Run command 'git rev-parse --short HEAD'.
        err: fatal: not a git repository (or any of the parent directories): .git
        Command returned '128'.
        Check metadata tree in '/var/tmp/tmt/run-317/plans/default/discover/default/tests/'.
        Detected library '{'path': '.', 'name': '/Libary/demo'}'.
        Fetch library './Libary/demo'.
        Copy local library '.' to '/var/tmp/tmt/run-317/plans/default/discover/default/libs/.'.
fatal: not a git repository (or any of the parent directories): .git
    finish
    workdir: /var/tmp/tmt/run-317/plans/default/finish
        summary: 0 tasks completed
    status: done
    Write file '/var/tmp/tmt/run-317/plans/default/finish/step.yaml'.
Unable to detect default branch for '/var/tmp/tmt/run-317/plans/default/discover/default/libs/.'. Is the git repository 'None' empty?

Note that /tests/libraries/local clones library from a git repo so it doesn't cover this.

sopos commented 1 year ago

I faced this as well. I think the solution could be to allow an _fmfid compound by just name attibute. E.g. missing url or path would suggest to use the current repo, i.e. equal to the path set to the current fmf root - that could be actually the easiest solution/workaround - internally set the path if only name was provided.

sopos commented 9 months ago

While it is documented as a correct identifier [1], it still does not work.

  1. https://fmf.readthedocs.io/en/latest/concept.html#identifiers