-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a new libvirt module for testing Salt: "salt_testenv" (#1404)
* Introduce new libvirt module for testing Salt: salt_testenv * Add 'salt_obs_flavor' variable to 'salt_testenv' * Install venv-salt-minion-testsuite also in SLE15 (all SPs) and Leap * Fix logic to prevent installing classic Salt in SLE12 * Refactor code to avoid unnecessary extra files * Increase VM memory for salt_testenv to run integration tests
- Loading branch information
Showing
6 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module "salt_testenv" { | ||
source = "../host" | ||
|
||
base_configuration = var.base_configuration | ||
use_os_released_updates = var.use_os_released_updates | ||
name = var.name | ||
additional_repos = var.additional_repos | ||
additional_repos_only = var.additional_repos_only | ||
additional_packages = var.additional_packages | ||
swap_file_size = var.swap_file_size | ||
ssh_key_path = var.ssh_key_path | ||
image = var.image | ||
provider_settings = var.provider_settings | ||
install_salt_bundle = true | ||
|
||
grains = { | ||
mirror = var.base_configuration["mirror"] | ||
salt_obs_flavor = var.salt_obs_flavor | ||
} | ||
|
||
roles = ["salt_testenv"] | ||
} | ||
|
||
output "configuration" { | ||
value = module.salt_testenv.configuration | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
variable "base_configuration" { | ||
description = "use module.base.configuration, see the main.tf example file" | ||
} | ||
|
||
variable "name" { | ||
description = "hostname, without the domain part" | ||
type = string | ||
} | ||
|
||
variable "use_os_released_updates" { | ||
description = "Apply all updates from SUSE Linux Enterprise repos" | ||
default = false | ||
} | ||
|
||
variable "salt_obs_flavor" { | ||
description = "One of: products, products:testing or products:next" | ||
type = string | ||
default = "products:testing" | ||
} | ||
|
||
variable "additional_repos" { | ||
description = "extra repositories in the form {label = url}, see README_ADVANCED.md" | ||
default = {} | ||
} | ||
|
||
variable "additional_repos_only" { | ||
description = "whether to exclusively use additional repos" | ||
default = false | ||
} | ||
|
||
variable "additional_packages" { | ||
description = "extra packages to install, see README_ADVANCED.md" | ||
default = [] | ||
} | ||
|
||
variable "swap_file_size" { | ||
description = "Swap file size in MiB, or 0 for none" | ||
default = 0 | ||
} | ||
|
||
variable "ssh_key_path" { | ||
description = "path of additional pub ssh key you want to use to access VMs, see README_ADVANCED.md" | ||
default = null | ||
} | ||
|
||
variable "provider_settings" { | ||
description = "Map of provider-specific settings, see the backend-specific README file" | ||
default = {} | ||
} | ||
|
||
variable "image" { | ||
description = "An image name, e.g. sles12sp4 or opensuse154o" | ||
type = string | ||
default = "opensuse154o" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../backend/host/versions.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
include: | ||
- default | ||
|
||
{% if grains['os'] == 'SUSE' and grains['osrelease_info'][0] == 15 %} | ||
{% if grains['osfullname'] == 'SLES' %} | ||
{% set repo_path = "15" if grains["osrelease"] == 15 else "15-SP" + grains["osrelease_info"][1]|string %} | ||
development_tools_repo_pool: | ||
pkgrepo.managed: | ||
- baseurl: http://{{ grains.get("mirror") | default("download.suse.de/ibs", true) }}/SUSE/Products/SLE-Module-Development-Tools/{{ repo_path }}/x86_64/product/ | ||
- refresh: True | ||
|
||
development_tools_repo_updates: | ||
pkgrepo.managed: | ||
- baseurl: http://{{ grains.get("mirror") | default("download.suse.de/ibs", true) }}/SUSE/Updates/SLE-Module-Development-Tools/{{ repo_path }}/x86_64/update/ | ||
- refresh: True | ||
{% endif %} | ||
|
||
{% if grains['osrelease_info'][1] >= 3 %} | ||
{% set repo_path = grains["osrelease"] %} | ||
{% else %} | ||
{% set repo_path = "SLE_15_SP" + grains["osrelease_info"][1]|string %} | ||
{% endif %} | ||
|
||
salt_testsuite_dependencies_repo: | ||
pkgrepo.managed: | ||
- baseurl: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:products:test-dependencies/{{ repo_path }}/ | ||
- refresh: True | ||
- gpgcheck: 0 | ||
- gpgkey: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:products:test-dependencies/{{ repo_path }}/repodata/repomd.xml.key | ||
|
||
salt_testing_repo: | ||
pkgrepo.managed: | ||
- baseurl: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:{{ grains["salt_obs_flavor"] }}/{{ repo_path }}/ | ||
- refresh: True | ||
- gpgcheck: 0 | ||
- gpgkey: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:{{ grains["salt_obs_flavor"] }}/{{ repo_path }}/repodata/repomd.xml.key | ||
|
||
install_salt_testsuite: | ||
pkg.installed: | ||
- name: python3-salt-testsuite | ||
- require: | ||
- pkgrepo: salt_testsuite_dependencies_repo | ||
- pkgrepo: salt_testing_repo | ||
|
||
{% endif %} | ||
|
||
{% if grains['os'] == 'Debian' %} | ||
{% if grains['osrelease'] == '9' %} | ||
{% set repo_path = 'Debian_9.0' %} | ||
{% elif grains['osrelease'] == '10' %} | ||
{% set repo_path = 'Debian_10' %} | ||
{% elif grains['osrelease'] == '11' %} | ||
{% set repo_path = 'Debian_11' %} | ||
{% elif grains['osrelease'] == '12' %} | ||
{% set repo_path = 'Debian_12' %} | ||
{% endif %} | ||
{% elif grains['osfullname'] == 'Ubuntu' %} | ||
{% if grains['osrelease'] == '20.04' %} | ||
{% set repo_path = 'Ubuntu_20.04' %} | ||
{% elif grains['osrelease'] == '22.04' %} | ||
{% set repo_path = 'Ubuntu_22.04' %} | ||
{% endif %} | ||
{% elif grains['osfullname'] == 'AlmaLinux' %} | ||
{% if grains['osrelease_info'][0] == 8 %} | ||
{% set repo_path = 'AlmaLinux_8' %} | ||
{% elif grains['osrelease_info'][0] == 9 %} | ||
{% set repo_path = 'AlmaLinux_9' %} | ||
{% endif %} | ||
{% elif grains['osfullname'] == 'CentOS Linux' %} | ||
{% if grains['osrelease_info'][0] == 7 %} | ||
{% set repo_path = 'CentOS_7' %} | ||
{% endif %} | ||
{% elif grains['osfullname'] == 'SLES' %} | ||
{% if grains['osrelease_info'][0] == 12 %} | ||
{% set repo_path = 'SLE_12' %} | ||
{% elif grains['osrelease_info'][0] == 15 %} | ||
{% set repo_path = 'SLE_15' %} | ||
{% endif %} | ||
{% elif grains['osfullname'] == 'Leap' %} | ||
{% if grains['osrelease_info'][0] == 15 %} | ||
{% set repo_path = 'openSUSE_Leap_15' %} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% if grains["salt_obs_flavor"] == "products" %} | ||
{% set salt_flavor_path = "bundle" %} | ||
{% elif grains["salt_obs_flavor"] == "products:testing" %} | ||
{% set salt_flavor_path = "bundle:testing" %} | ||
{% elif grains["salt_obs_flavor"] == "products:next" %} | ||
{% set salt_flavor_path = "bundle:next" %} | ||
{% else %} | ||
{{ raise("Unknown salt_obs_flavor set") }} | ||
{% endif %} | ||
|
||
salt_bundle_testsuite_repo: | ||
pkgrepo.managed: | ||
{% if grains['os'] in ["Debian", "Ubuntu"] %} | ||
- humanname: salt_bundle_testsuite_repo | ||
- file: /etc/apt/sources.list.d/salt_bundle_testsuite_repo.list | ||
- name: deb http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:{{ salt_flavor_path }}:testsuite/{{ repo_path }}/ / | ||
- key_url: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:{{ salt_flavor_path }}:testsuite/{{ repo_path }}/Release.key | ||
{% else %} | ||
- baseurl: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:{{ salt_flavor_path }}:testsuite/{{ repo_path }}/ | ||
- gpgkey: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:{{ salt_flavor_path }}:testsuite/{{ repo_path }}/repodata/repomd.xml.key | ||
- gpgcheck: 0 | ||
{% endif %} | ||
- refresh: True | ||
|
||
install_salt_bundle_testsuite: | ||
pkg.installed: | ||
- name: venv-salt-minion-testsuite | ||
- require: | ||
- pkgrepo: salt_bundle_testsuite_repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,7 @@ base: | |
'roles:registry': | ||
- match: grain | ||
- registry | ||
|
||
'roles:salt_testenv': | ||
- match: grain | ||
- salt_testenv |