teemtee / fmf

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

Add support for merging list with dict #256

Open kkaarreell opened 2 weeks ago

kkaarreell commented 2 weeks ago

it is questionable if we really need a new operator. Can't we simply stick to +?

kkaarreell commented 2 weeks ago
$ cat main.fmf 
discover:
    - how: fmf
      url: https://github.com/project1
    - how: fmf
      url: https://github.com/project2

/basic:
    summary: Quick set of basic functionality tests
    discover+*:
        filter: "tier:1"

/features:
    summary: Detailed tests for individual features
    discover+*:
        filter: "tier:2"
$ fmf show
/basic
discover: [{'filter': 'tier:1', 'how': 'fmf', 'url': 'https://github.com/project1'},
 {'filter': 'tier:1', 'how': 'fmf', 'url': 'https://github.com/project2'}]
summary: Quick set of basic functionality tests

/features
discover: [{'filter': 'tier:2', 'how': 'fmf', 'url': 'https://github.com/project1'},
 {'filter': 'tier:2', 'how': 'fmf', 'url': 'https://github.com/project2'}]
summary: Detailed tests for individual features
LecrisUT commented 2 weeks ago

Just a thought, if we go with the * operator, I think it would be better for it to be *+

kkaarreell commented 2 weeks ago

So, after reading through the original issue it seems there are more people favoring using the + operator. With that in mind, I have pushed another commit which modified the code so that only + is used.

I like this option more (if you want to compare both variants see the 1st commit only).

Moreover, now the following use case seems to be handled as well:

discover:
    how: fmf
    prune: True
    adjust-tests:
        - duration+: '*3'
          when: hw == slow

/path:
  discover+:
    - name: upstream
      url: https://some.url
    - name: downstream
      url: https://other.url
$ fmf show
/path
discover: [{'adjust-tests': [{'duration+': '*3', 'when': 'hw == slow'}],
  'how': 'fmf',
  'name': 'upstream',
  'prune': True,
  'url': 'https://some.url'},
 {'adjust-tests': [{'duration+': '*3', 'when': 'hw == slow'}],
  'how': 'fmf',
  'name': 'downstream',
  'prune': True,
  'url': 'https://other.url'}]
kkaarreell commented 6 days ago

@psss Hi, I do not plan any further updates unless requested. Please review.

kkaarreell commented 4 days ago

/packit retest-failed

kkaarreell commented 4 days ago

@psss Hi, could you please check failing tests? It doesn't seem related, rather like a change in Fedora distro that is not reflected in tests. Thank you.