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

test: add a test that creating VMs until no default name generated and checking #1800

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions test/check-machines-create
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import contextlib
import math
import os
import re
import string
import time
import xml.etree.ElementTree as ET
from datetime import datetime
Expand Down Expand Up @@ -253,6 +254,9 @@ class TestMachinesCreate(machineslib.VirtualMachinesCase):
dialog.cancel()

def testCreateNameGeneration(self):
m = self.machine
b = self.browser

config = TestMachinesCreate.TestCreateConfig
runner = TestMachinesCreate.CreateVmRunner(self)

Expand Down Expand Up @@ -304,6 +308,37 @@ class TestMachinesCreate(machineslib.VirtualMachinesCase):
create_and_run=False),
check_env_empty=False)

# Create VMs until no default generated name
for v in string.ascii_uppercase:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems very expensive, it seems to add 3 minutes to our total CI runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But these VMs are just defined, not started.

vm_name = predicted_name + "-" + v
vm_path = "/tmp/" + vm_name

m.execute(f"touch {vm_path}")
m.execute(
"virt-install --connect qemu:///system"
f" --name {vm_name}"
f" --os-variant {config.FEDORA_28_SHORTID}"
f" --disk {vm_path}"
" --memory 1 --wait -1 --print-xml > /tmp/xml;"
" virsh define /tmp/xml")
b.wait_visible(f"#vm-{vm_name}-system-name")

self.addCleanup(self.machine.execute, f"virsh undefine {vm_name}")

b.click("#create-new-vm")
b.wait_visible("#create-vm-dialog")
b.wait_attr("#vm-name", "placeholder", "Unique name")

b.click("#os-select-group > div button")
b.click(f"#os-select li:contains('{config.FEDORA_28}') button")
b.wait_attr("#os-select-group input", "value", config.FEDORA_28)

b.click("#create-and-edit")
b.wait_visible("#create-vm-dialog")
b.wait_text("#vm-name-group .pf-v5-c-helper-text__item-text", "Name must not be empty")
b.wait_visible("#create-and-run[aria-disabled=true]")
b.wait_visible("#create-and-edit[aria-disabled=true]")

def testCreateCloudBaseImage(self):
runner = TestMachinesCreate.CreateVmRunner(self)
config = TestMachinesCreate.TestCreateConfig
Expand Down