Skip to content

Commit

Permalink
Includes a section in the config file to provide test instance catalo…
Browse files Browse the repository at this point in the history
…g for ec2 (#928)
  • Loading branch information
apozsuse authored Dec 2, 2024
1 parent e1d86fa commit 550ab68
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 0 deletions.
37 changes: 37 additions & 0 deletions config/mash_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,43 @@ cloud:
us-gov-west-1: ami-0e8f52046c02613e9
us-west-1: ami-0ee3e1e65adeef858
us-west-2: ami-0ec021424fb596d6c
test_instance_catalog:
- region: us-east-1
arch: x86_64
instance_names:
- c5.large
- m5.large
- t3.small
boot_types:
- uefi-preferred
- uefi
cpu_options: []
- region: us-east-1
arch: x86_64
instance_names:
- i3.large
- t2.small
boot_types:
- bios
cpu_options: []
- region: us-east-2
arch: x86_64
instance_names:
- m6a.large
- c6a.large
- r6a.large
boot_types:
- uefi-preferred
- uefi
cpu_options:
- AmdSevSnp_enabled
- region: us-east-1
arch: aarch64
instance_names:
- t4g.small
- m6g.medium
boot_types: []
cpu_options: []
test:
img_proof_timeout: 600
upload:
Expand Down
15 changes: 15 additions & 0 deletions mash/services/test/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# along with mash. If not, see <http://www.gnu.org/licenses/>
#

from mash.mash_exceptions import MashConfigException
from mash.services.base_config import BaseConfig
from mash.services.test.defaults import Defaults

Expand Down Expand Up @@ -46,3 +47,17 @@ def get_img_proof_timeout(self):
element='test'
)
return img_proof_timeout or Defaults.get_img_proof_timeout()

def get_test_ec2_instance_catalog(self):
"""
Return the instance catalog configured for ec2 tests
"""

ec2_cloud_info = self.get_cloud_data().get('ec2', {})
instance_catalog = ec2_cloud_info.get('test_instance_catalog', [])

if not instance_catalog:
raise MashConfigException(
'Ec2 test instance catalog must be provided in config file.'
)
return instance_catalog
37 changes: 37 additions & 0 deletions test/data/mash_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,43 @@ cloud:
ap-northeast-2: ami-249b554a
cn-north-1: ami-bcc45885
us-gov-west-1: ami-c2b5d7e1
test_instance_catalog:
- region: us-east-1
arch: x86_64
instance_names:
- c5.large
- m5.large
- t3.small
boot_types:
- uefi-preferred
- uefi
cpu_options: []
- region: us-east-1
arch: x86_64
instance_names:
- i3.large
- t2.small
boot_types:
- bios
cpu_options: []
- region: us-east-2
arch: x86_64
instance_names:
- m6a.large
- c6a.large
- r6a.large
boot_types:
- uefi-preferred
- uefi
cpu_options:
- AmdSevSnp_enabled
- region: us-east-1
arch: aarch64
instance_names:
- t4g.small
- m6g.medium
boot_types: []
cpu_options: []
test:
img_proof_timeout: 600
upload:
Expand Down
57 changes: 57 additions & 0 deletions test/unit/services/test/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,60 @@ def test_get_log_file(self):

def test_get_img_proof_timeout(self):
assert self.empty_config.get_img_proof_timeout() == 600

def test_get_test_ec2_instance_catalog(self):
expected_catalog = [
{
"region": "us-east-1",
"arch": "x86_64",
"instance_names": [
"c5.large",
"m5.large",
"t3.small"
],
"boot_types": [
"uefi-preferred",
"uefi"
],
"cpu_options": []
},
{
"region": "us-east-1",
"arch": "x86_64",
"instance_names": [
"i3.large",
"t2.small"
],
"boot_types": [
"bios"
],
"cpu_options": []
},
{
"region": "us-east-2",
"arch": "x86_64",
"instance_names": [
"m6a.large",
"c6a.large",
"r6a.large"
],
"boot_types": [
"uefi-preferred",
"uefi"
],
"cpu_options": [
"AmdSevSnp_enabled"
]
},
{
"region": "us-east-1",
"arch": "aarch64",
"instance_names": [
"t4g.small",
"m6g.medium"
],
"boot_types": [],
"cpu_options": []
}
]
assert self.config.get_test_ec2_instance_catalog() == expected_catalog

0 comments on commit 550ab68

Please sign in to comment.