Simplify test spec structure

This commit is contained in:
Julio Castillo 2022-12-06 15:50:39 +01:00
parent 1981647595
commit 8b664fc5e3
3 changed files with 8 additions and 89 deletions

View File

@ -57,14 +57,11 @@ class FabricTestFile(pytest.File):
raise Exception(f'cannot read test spec {self.path}: {e}')
except KeyError as e:
raise Exception(f'`module` key not found in {self.path}: {e}')
common = raw.pop('common_tfvars', [])
for test_name, spec in raw.get('tests', {}).items():
spec = {} if spec is None else spec
inventories = spec.get('inventory', [f'{test_name}.yaml'])
try:
tfvars = spec['tfvars']
except KeyError:
raise Exception(
f'test `{test_name}` in {self.path} does not contain a `tfvars` key'
)
tfvars = common + [f'{test_name}.tfvars'] + spec.get('tfvars', [])
for i in inventories:
name = test_name
if isinstance(inventories, list) and len(inventories) > 1:

View File

@ -13,48 +13,16 @@
# limitations under the License.
module: modules/net-vpc
common_tfvars:
- common.tfvars
tests:
simple:
tfvars:
- common.tfvars
subnets:
tfvars:
- common.tfvars
- subnets.tfvars
peering:
tfvars:
- common.tfvars
- peering.tfvars
shared_vpc:
tfvars:
- common.tfvars
- shared_vpc.tfvars
factory:
tfvars:
- common.tfvars
- factory.tfvars
psa_simple:
tfvars:
- common.tfvars
- psa_simple.tfvars
psa_routes_export:
tfvars:
- common.tfvars
- psa_routes_export.tfvars
psa_routes_import:
tfvars:
- common.tfvars
- psa_routes_import.tfvars
psa_routes_import_export:
tfvars:
- common.tfvars
- psa_routes_import_export.tfvars

View File

@ -14,65 +14,19 @@
module: modules/organization
common_tfvars:
- common.tfvars
tests:
audit_config:
tfvars:
- common.tfvars
- audit_config.tfvars
iam:
tfvars:
- common.tfvars
- iam.tfvars
iam_additive:
tfvars:
- common.tfvars
- iam_additive.tfvars
logging:
tfvars:
- common.tfvars
- logging.tfvars
logging_exclusions:
tfvars:
- common.tfvars
- logging_exclusions.tfvars
org_policies_list:
tfvars:
- common.tfvars
- org_policies_list.tfvars
org_policies_boolean:
tfvars:
- common.tfvars
- org_policies_boolean.tfvars
org_policies_custom_constraints:
tfvars:
- common.tfvars
- org_policies_custom_constraints.tfvars
tags:
tfvars:
- common.tfvars
- network_tags.tfvars
- resource_tags.tfvars
firewall_policies:
tfvars:
- common.tfvars
- firewall_policies.tfvars
firewall_policies_factory:
tfvars:
- common.tfvars
- firewall_policies_factory.tfvars
firewall_policies_factory_combined:
tfvars:
- common.tfvars
- firewall_policies.tfvars
- firewall_policies_factory.tfvars