teemtee / tmt

Test Management Tool
MIT License
79 stars 117 forks source link

Appeared unexpected hardware transformation when provisioning with beaker #2322

Closed guoguojenna closed 9 months ago

guoguojenna commented 10 months ago

Here is the fmf:

$ cat multi-v7.fmf 
summary: Demo-7
discover:
      - name: server-client-test
        how: fmf
        test: /rdma/sanity
provision:
      - how: beaker
        name: server-1
        role: server
        image: RHEL-9.3.0-20230911.0
        hardware:
            hostname: $SERVERS
      - how: beaker
        name: client-1
        role: client
        image: RHEL-9.3.0-20230911.0
        hardware:
            hostname: $CLIENTS
execute:
        how: tmt 

I ran like this: $ $ tmt run --environment "SERVERS=rdma-qe-14.rdma.lab.eng.rdu2.redhat.com CLIENTS=rdma-qe-15.rdma.lab.eng.rdu2.redhat.com" plans --name /rdma/multi-hosts-demo/multi-v7 -d -vvv ............... provision workdir: /var/tmp/tmt/run-007/rdma/multi-hosts-demo/multi-v7/provision Workdir '/var/tmp/tmt/run-007/rdma/multi-hosts-demo/multi-v7/provision/server-1' created. how: beaker name: server-1 order: 50 hardware: hostname: rdma-qe-14.rdma.lab.eng.rdu2.redhat.com

    image: RHEL-9.3.0-20230911.0
    **Transformed hardware:
        and:
          - not:
                hostname:
                    _op: ==
                    _value: rdma-qe-14.rdma.lab.eng.rdu2.redhat.com**
    guest: has been requested

............... In beaker,

<hostRequires>
        <and>
          <not>
            <hostname op="==" value="rdma-qe-14.rdma.lab.eng.rdu2.redhat.com"/>
          </not>
        </and>
        <system_type value="Machine"/>
      </hostRequires>

I expect it will provision the machine I specified in the command line --environment, but it selected a system not the one I specified. Did I misuse something?

Thanks.

happz commented 10 months ago

I'm afraid this is a rather ugly bug introduced in 1.27. A fix is attached.

guoguojenna commented 10 months ago

It works as expected after applying the fix https://github.com/teemtee/tmt/pull/2324.