teemtee / fmf

Flexible Metadata Format
GNU General Public License v2.0
22 stars 28 forks source link

tmt export --nitrate --create malformes adjust rule #125

Closed lukaszachy closed 1 year ago

lukaszachy commented 3 years ago

Before export:

adjust:
  when: distro ~< rhel-8.4
  enabled: False

After export when key is missing:

adjust:
    enabled: false

This makes fmf/tmt to raise fmf.utils.FormatError: No condition defined in adjust rule., including in tmt test lint

I used tmt-1.3.1-1.20210330165247205001.master.64.g02badb3.fc33.noarch fmf-0.15.2-1.20210326172917712489.master.3.ga401333.fc33.noarch

lukaszachy commented 3 years ago

Easier steps to reproduce:

  1. tmt init
  2. create 'before.fmf` with
    test: true
    adjust:
    when: distro ~< rhel-8.4
    enabled: False
  3. run reproducer.py
    import tmt
    test = tmt.Tree('.').tests(names=['/before'])[0]
    with test.node as data:
    data["foo"] = "bar"

Interesting enough I was not able to reproduce it with pure 'fmf' e.g. in

import fmf
with fmf.Tree('.').find('/before') as data:
    data["foo"] = "bar"
psss commented 3 years ago

This seems to be caused by the adjust() method. Pure fmf reproducer:

import fmf
tree = fmf.Tree('.')
tree.adjust(fmf.context.Context())
test = tree.find('/before')
with test as data:
    data["foo"] = "bar"
psss commented 3 years ago

Should be fixed by psss/fmf/pull/124.

lukaszachy commented 3 years ago

I'd say this is a blocker - User needs to revert adjust rule changes but keep added extra-nitrate and if user doesn't commit fmf files before tmt export (which is not yet enforced by tmt) then they loose original adjust data for good.

psss commented 3 years ago

Yes, let's fix this soon. And release a new fmf right away.

lukaszachy commented 1 year ago

Fixed for some time, added correct milestone and closing