Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement programatic expansion of metadata - macros #152

Open
sopos opened this issue Feb 14, 2022 · 2 comments
Open

implement programatic expansion of metadata - macros #152

sopos opened this issue Feb 14, 2022 · 2 comments

Comments

@sopos
Copy link

sopos commented Feb 14, 2022

Example:
imagine this metadata:

/old-syntax:
        environment+:
            rsyslogSyntax: old
        /x509_name:
            extra-summary: CONDITIONAL_PHASES_BL=ossl rsyslogSyntax=old /rsyslog/Sanity/gnutls-openssl
/new-syntax:
        environment+:
            rsyslogSyntax: new
        /x509_name:
            extra-summary: CONDITIONAL_PHASES_BL=ossl rsyslogSyntax=new /rsyslog/Sanity/gnutls-openssl

to simplify it one could use something like:

%for syntax in [old, new]:
/%syntax%-syntax:
        environment+:
            rsyslogSyntax: %syntax%
        /x509_name:
            extra-summary: CONDITIONAL_PHASES_BL=ossl rsyslogSyntax=%syntax% /rsyslog/Sanity/gnutls-openssl
%rof

For more metadata worth simplification see https://github.com/RedHat-SP-Security/tests/blob/69e188bad1da05dbdbf21d102bcec25655ec9a3b/rsyslog/Sanity/gnutls-openssl/main.fmf#L57
The life metadata cannot be used directly due to nitrate TC mapping but it could be easily without it.

The fmf files would be pre-processed using a metalanguage and then processed as usual.

@sopos sopos changed the title implement programatic expansion of the metadata implement programatic expansion of metadata Feb 14, 2022
@sopos sopos changed the title implement programatic expansion of metadata implement programatic expansion of metadata - macros Apr 21, 2022
@jscotka
Copy link
Collaborator

jscotka commented May 6, 2022

Hi @sopos ,
theoretically you are trying to implement something like multiplexing what is implemented in avocado project https://avocado-framework.readthedocs.io/en/latest/plugins/optional/multiplexer.html , so that generating matrix of combinations

But in generic it could be also implemented by my extension via python pytest, you can in python write test generator for pytest, so that you can do whatever you want and generate matrix as you wish with full python selmantics, so that powerfull instead of trying to add own semantic

Then fmf will collect data based on your generation. simply e.g. via @pytest.mark.parametrize(....)
#136

So that your macro extension is something between this avocado multiplexer and dynamic python tests from my PoV.

@sopos
Copy link
Author

sopos commented May 12, 2022

another real use case (from rhel6 :) :
There is a dual component rsyslog and rsyslog7. The test normally require rsyslog* packages. However if the rsyslog7 is going to be tested all such requires should be basicaly replaces with rsyslog7*.
Currently, this can be achieved by implementing to all the tests following adjust:

adjust:
  - require-:
      - rsyslog
    require+:
      - rsyslog7
    when: component = rsyslog7

plus for all the required sub-packages.

An elegant solution might be to use the macro language:

set rsyslog=rsyslog7
require:
  - ${rsyslog}
  - ${rsyslog}-gnutls

So the only require thing would be to replace all the requirement rsyslog with ${rsyslog}.

Another solution might be to use templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants