-
Notifications
You must be signed in to change notification settings - Fork 343
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
Filtering Specific Variants with --mux-filter-only
Includes Unrelated Variants
#6084
Comments
Hi @Moghees244 in your example the -!mux
-qemu:
+qemu: !mux
remote_host: "127.0.0.1"
remote_ssh_port: "2222"
user: "root" |
Hi @richtja . There's still this issue: qemu: !mux
remote_host: "127.0.0.1"
remote_ssh_port: "2222"
user: "root"
qemu-guests: !mux
kali:
remote_host: "127.0.0.1"
remote_ssh_port: "2223"
user: "root"
domain_name: "kali"
ewaol:
remote_host: "127.0.0.1"
remote_ssh_port: "2224"
user: "root"
domain_name: "ewaol" avocado variants --mux-yaml params.yaml --mux-filter-only /run/qemu-guests/kali
Multiplex variants (1):
Variant run-qemu-qemu-guests-kali-9a12: /run/qemu, /run/qemu-guests/kali
avocado run test.py --mux-yaml params.yaml --mux-filter-only /run/qemu-guests/kali
JOB ID : 21939080dd834ef05c4445bd832b321ac80a5833
JOB LOG : /root/avocado/job-results/job-2025-01-03T12.17-2193908/job.log
(1/2) test.py:TestKVMGuestsAccess.test_guest_ip_addr;run-qemu-qemu-guests-kali-9a12: STARTED
(2/2) test.py:TestKVMGuestsAccess.test_guest_ssh_connection;run-qemu-qemu-guests-kali-9a12: STARTED
(1/2) test.py:TestKVMGuestsAccess.test_guest_ip_addr;run-qemu-qemu-guests-kali-9a12: ERROR: Multiple leaves contain the key 'remote_host'; ['/run/qemu=>127.0.0.1', '/run/qemu-guests/kali=>127.0.0.1'] (0.02 s)
(2/2) test.py:TestKVMGuestsAccess.test_guest_ssh_connection;run-qemu-qemu-guests-kali-9a12: ERROR: Multiple leaves contain the key 'remote_host'; ['/run/qemu=>127.0.0.1', '/run/qemu-guests/kali=>127.0.0.1'] (0.02 s)
RESULTS : PASS 0 | ERROR 2 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML : /root/avocado/job-results/job-2025-01-03T12.17-2193908/results.html
JOB TIME : 1.60 s |
Hi @Moghees244 can you please send the reproducer of this issue of your test.py, when using examples/tests/params.py it seems to be working correctly. |
I will share the file but if you simply check the output of this command: avocado variants --mux-yaml params.yaml --mux-filter-only /run/qemu-guests/kali it returns :
|
Just pasting it here: from avocado import Test
from avocado.utils import ssh
class SshDmesgTest(Test):
"""
Execute ssh connection to the host , execute dmesg command and verify the output contains no errors.
"""
def setUp(self):
"""
Setup variables and open SSH session.
"""
self.remote_host = self.params.get('remote_host', default='127.0.0.1')
self.user = self.params.get('user', default='root')
self.remote_ssh_port = self.params.get('remote_ssh_port', default='2222')
self.password = 'abc123'
# Open SSH session
self.session = ssh.Session(self.remote_host, self.remote_ssh_port, user=self.user, password=self.password)
def testDmesgCommand(self):
"""
Test the presence of any error message in dmesg output.
"""
result = self.session.cmd('dmesg')
# Check if the command was successful
self.assertEqual(result.exit_status, 0, "Command failed")
# Parse the output for a specific string
self.log.info("Command output: %s", result.stdout_text)
self.assertNotIn(result.stdout_text ,"No error found in dmesg output")
def tearDown(self):
"""
Close the SSH session.
"""
if self.session:
self.session.quit() |
Hi @Moghees244, I'd say the main point about your issue is an incorrect set of expectations with the YAML you're using and the expectations you have. First, the hierarchy built out of the YAML structure is one that allows for an organization of parameters in a namespace. Second, the "filter only" approach is about filtering the resulting variants, not the namespaces, and AFAICT it's working as expected. So your comment saying that "/run/qemu must not be in the response" is not accurate. Consider the following YAML instead: qemu:
remote_host: "127.0.0.1"
remote_ssh_port: "2222"
user: "root"
guests: !mux
kali:
domain_name: "kali"
remote_ssh_port: "2223"
ewaol:
domain_name: "ewaol"
remote_ssh_port: "2224" When getting parameters from a test, you could using different namespaces if the names of parameters where the same, but different in meaning, say from user = self.params.get('user', path='/run/qemu', default='root') Again, the path is unnecessary in this example, because I'm saying all that because it should be clear that |
Bug Description
Filtering specific variants using
--mux-filter-only
does not work as expected. When attempting to filter for a single variant (e.g.,/run/qemu-guests/kali
), additional unrelated variants are also included in the output.Steps to reproduce
test_params.yaml
file with the following structure:avocado variants --mux-yaml test_params.yaml --mux-filter-only /run/qemu-guests
avocado variants --mux-yaml test_params.yaml --mux-filter-only /run/qemu-guests/kali
Expected behavior
The command
avocado variants --mux-yaml test_params.yaml --mux-filter-only /run/qemu-guests/kali
should return only thekali
variant and exclude other unrelated variants likeewaol
.Current behavior
The command returns multiple variants instead of only the specified one. Example output:
System information
lsb_release -a
:avocado -v
:The text was updated successfully, but these errors were encountered: