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

Update auto_update_boot_source_vm to use instance types #191

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RoniKishner
Copy link
Contributor

@RoniKishner RoniKishner commented Jan 28, 2025

Short description:

Use instance types instead of templates to create VM from provided data sources

More details:

Since centos-10/rhel-10 don't have templates we can't add them to the testing matrix, as such we should update VM creation method in Data Source tests

  • Add centos-stream10, rhel-10 the testing matrix auto_update_data_source_matrix
  • Remove template_os from auto_update_data_source_matrix
  • Change creation method in auto_update_boot_source_vm to use instance types
  • Change assertion method in assert_os_version_mismatch_in_vm to assert: vm guest OS == preference name given by the data source label
  • Change matrix_auto_boot_data_import_cron_prefixes since the matrix no longer has auto_update_data_source_matrix
What this PR does / why we need it:

Add coverage for centos10/rhel10-beta

Special notes for reviewer:

Next release rhel10-beta naming will be needed to change to rhel-10

jira-ticket:

https://issues.redhat.com/browse/CNV-41859

@redhat-cnv-qe-bot1
Copy link

Report bugs in Issues

The following are automatically added:

  • Add reviewers from OWNER file (in the root of the repository) under reviewers section.
  • Set PR size label.
  • New issue is created for the PR. (Closed when PR is merged/closed)
  • Run pre-commit if .pre-commit-config.yaml exists in the repo.

Available user actions:

  • To mark PR as WIP comment /wip to the PR, To remove it from the PR comment /wip cancel to the PR.
  • To block merging of PR comment /hold, To un-block merging of PR comment /hold cancel.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To cherry pick a merged PR comment /cherry-pick <target branch to cherry-pick to> in the PR.
    • Multiple target branches can be cherry-picked, separated by spaces. (/cherry-pick branch1 branch2)
    • Cherry-pick will be started when PR is merged
  • To build and push container image command /build-and-push-container in the PR (tag will be the PR number).
    • You can add extra args to the Podman build command
      • Example: /build-and-push-container --build-arg OPENSHIFT_PYTHON_WRAPPER_COMMIT=<commit_hash>
  • To add a label by comment use /<label name>, to remove, use /<label name> cancel
  • To assign reviewers based on OWNERS file use /assign-reviewers
  • To check if PR can be merged use /check-can-merge
  • to assign reviewer to PR use /assign-reviewer @<reviewer>
Supported /retest check runs
  • /retest tox: Retest tox
  • /retest build-container: Retest build-container
  • /retest all: Retest all
Supported labels
  • hold
  • verified
  • wip
  • lgtm

Copy link
Collaborator

@polarion-jenkins polarion-jenkins left a comment

Choose a reason for hiding this comment

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

D/S test tox -e verify-bugs-are-open passed: cnv-tests-tox-executor/6073

Copy link
Collaborator

@polarion-jenkins polarion-jenkins left a comment

Choose a reason for hiding this comment

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

D/S test tox -e verify-bugs-are-open passed: cnv-tests-tox-executor/6152

@RoniKishner
Copy link
Contributor Author

/build-and-push-container

@redhat-cnv-qe-bot
Copy link

New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-191 published

@RoniKishner
Copy link
Contributor Author

/verified
Verified all uses of auto_update_data_source_matrix

@@ -187,10 +187,12 @@ def _get_default_storage_class(sc_list):
# If the DataImportCron uses a different prefix than the DataSource name
# use data_import_cron_prefix in matrix dict to specify new prefix.
auto_update_data_source_matrix = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

templates are still supported. this drops coverage for templates. No?

Copy link
Contributor

Choose a reason for hiding this comment

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

can we extend this for cluster_prefeence

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is a good idea, but lets try and merge this first before we add an assertion on the used preferences, I don't want to make this PR too big and over extend it's purpose


LOGGER = logging.getLogger(__name__)
RHEL9_NAME = "rhel9"


def assert_os_version_mismatch_in_vm(vm, expected_os):
expected_os_params = re.match(r"(?P<os_name>[a-z]+)(-stream)?(?P<os_ver>[0-9]+)", expected_os).groupdict()
def assert_os_version_mismatch_in_vm(vm, latest_fedora_release_version):
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want to cover instance types, that is great. But let's not remove coverage for templates till they are removed.

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

Choose a reason for hiding this comment

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

should we cover both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point, but I respectfully disagree that this test is meant to cover templates. Its primary focus is on the Data Import Cron, and while it does use a template, that’s more of a tool rather than the core intent of the test.

In the past, creating a VM from templates was a common practice, and as a result, VirtualMachineForTemplates became the default approach. However, changing the method here does not necessarily imply a loss of coverage. Let me know what you think!

Copy link
Collaborator

Choose a reason for hiding this comment

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

The test file is called "test_ssp_common_templates_boot_sources.py". I am not in favor of removing template coverage with instance type as of now. When templates are removed, please feel free to remove associated tests. Till then if you want to add coverage for instance type, please add new tests in a separate file.


LOGGER = logging.getLogger(__name__)
RHEL9_NAME = "rhel9"


def assert_os_version_mismatch_in_vm(vm, expected_os):
expected_os_params = re.match(r"(?P<os_name>[a-z]+)(-stream)?(?P<os_ver>[0-9]+)", expected_os).groupdict()
def assert_os_version_mismatch_in_vm(vm, latest_fedora_release_version):
Copy link
Collaborator

Choose a reason for hiding this comment

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

The test file is called "test_ssp_common_templates_boot_sources.py". I am not in favor of removing template coverage with instance type as of now. When templates are removed, please feel free to remove associated tests. Till then if you want to add coverage for instance type, please add new tests in a separate file.

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

Successfully merging this pull request may close these issues.

8 participants