Skip to content

Commit

Permalink
Remove static path value for 'custom_sizes.json'
Browse files Browse the repository at this point in the history
  • Loading branch information
lpalovsky committed Aug 9, 2024
1 parent b955beb commit 7fcbfe8
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 19 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ sub prepare_tfvars_file {
library => 'library_parameter_file'
);
my %tfvars_template_url = (
deployer => data_url('sles4sap/sdaf/DEPLOYER.tfvars'),
sap_system => data_url('sles4sap/sdaf/SAP_SYSTEM.tfvars'),
workload_zone => data_url('sles4sap/sdaf/WORKLOAD_ZONE.tfvars'),
library => data_url('sles4sap/sdaf/LIBRARY.tfvars')
deployer => data_url('sles4sap/sap_deployment_automation_framework/DEPLOYER.tfvars'),
sap_system => data_url('sles4sap/sap_deployment_automation_framework/SAP_SYSTEM.tfvars'),
workload_zone => data_url('sles4sap/sap_deployment_automation_framework/WORKLOAD_ZONE.tfvars'),
library => data_url('sles4sap/sap_deployment_automation_framework/LIBRARY.tfvars')
);
croak 'Deployment type not specified' unless $args{deployment_type};
croak "Unknown deployment type: $args{deployment_type}" unless $tfvars_os_variable{$args{deployment_type}};
Expand Down
8 changes: 4 additions & 4 deletions t/20_sdaf_deployment_library.t
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ subtest '[prepare_tfvars_file] Test curl commands' => sub {

# '-o' is only for checking if correct parameter gets picked from %tfvars_os_variable
my %expected_results = (
deployer => 'curl -v -fL http://openqa.suse.de/data/sles4sap/sdaf/DEPLOYER.tfvars -o deployer_parameter_file',
sap_system => 'curl -v -fL http://openqa.suse.de/data/sles4sap/sdaf/SAP_SYSTEM.tfvars -o sap_system_parameter_file',
workload_zone => 'curl -v -fL http://openqa.suse.de/data/sles4sap/sdaf/WORKLOAD_ZONE.tfvars -o workload_zone_parameter_file',
library => 'curl -v -fL http://openqa.suse.de/data/sles4sap/sdaf/LIBRARY.tfvars -o library_parameter_file'
deployer => 'curl -v -fL http://openqa.suse.de/data/sles4sap/sap_deployment_automation_framework/DEPLOYER.tfvars -o deployer_parameter_file',
sap_system => 'curl -v -fL http://openqa.suse.de/data/sles4sap/sap_deployment_automation_framework/SAP_SYSTEM.tfvars -o sap_system_parameter_file',
workload_zone => 'curl -v -fL http://openqa.suse.de/data/sles4sap/sap_deployment_automation_framework/WORKLOAD_ZONE.tfvars -o workload_zone_parameter_file',
library => 'curl -v -fL http://openqa.suse.de/data/sles4sap/sap_deployment_automation_framework/LIBRARY.tfvars -o library_parameter_file'
);

for my $type (keys %expected_results) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ use parent 'sles4sap::sap_deployment_automation_framework::basetest';

use strict;
use warnings;
use sles4sap::sap_deployment_automation_framework::deployment;
use sles4sap::sap_deployment_automation_framework::naming_conventions;
use sles4sap::sap_deployment_automation_framework::deployment
qw(serial_console_diag_banner load_os_env_variables prepare_tfvars_file sdaf_execute_deployment az_login);
use sles4sap::sap_deployment_automation_framework::naming_conventions
qw(generate_resource_group_name get_sdaf_config_path convert_region_to_short);
use sles4sap::console_redirection;
use serial_terminal qw(select_serial_terminal);
use testapi;
Expand All @@ -25,29 +27,39 @@ sub test_flags {
sub run {
serial_console_diag_banner('Module sdaf_deploy_sap_systems.pm : start');
select_serial_terminal();
my $env_code = get_required_var('SDAF_ENV_CODE');
my $sap_sid = get_required_var('SAP_SID');
my $workload_vnet_code = get_required_var('SDAF_WORKLOAD_VNET_CODE');
my $sdaf_region_code = convert_region_to_short(get_required_var('PUBLIC_CLOUD_REGION'));

# SAP systems use same VNET as workload zone
set_var('SDAF_VNET_CODE', $workload_vnet_code);
# Setup Workload zone openQA variables - used for tfvars template
set_var('SDAF_RESOURCE_GROUP', generate_resource_group_name(deployment_type => 'sap_system'));

# From now on everything is executed on Deployer VM (residing on cloud).
connect_target_to_serial();
load_os_env_variables();

# Setup Workload zone openQA variables - used for tfvars template
set_var('SDAF_RESOURCE_GROUP', generate_resource_group_name(deployment_type => 'sap_system'));
# SAP systems use same VNET as workload zone
set_var('SDAF_VNET_CODE', get_required_var('SDAF_WORKLOAD_VNET_CODE'));
# 'vnet_code' variable changes with deployment type.
set_os_variable('vnet_code', get_required_var('SDAF_WORKLOAD_VNET_CODE'));
prepare_tfvars_file(deployment_type => 'sap_system');

# Custom VM sizing since default VMs are way too large for functional testing
# Check for details: https://learn.microsoft.com/en-us/azure/sap/automation/configure-extra-disks#custom-sizing-file
my $custom_sizes_target_path = get_sdaf_config_path(
deployment_type => 'sap_system',
vnet_code => $workload_vnet_code,
sap_sid => $sap_sid,
sdaf_region_code => $sdaf_region_code,
env_code => $env_code);

my $retrieve_custom_sizing = join(' ', 'curl', '-v', '-fL',
data_url('sles4sap/sdaf/custom_sizes.json'),
'-o', get_os_variable('CONFIG_REPO_PATH') . '/SYSTEM/LAB-SECE-SAP04-QES/custom_sizes.json');
data_url('sles4sap/sap_deployment_automation_framework/custom_sizes.json'),
'-o', $custom_sizes_target_path . '/custom_sizes.json');

assert_script_run($retrieve_custom_sizing);

az_login();
sdaf_execute_deployment(deployment_type => 'sap_system', timeout => 3600);

# diconnect the console
disconnect_target_from_serial();

Expand Down

0 comments on commit 7fcbfe8

Please sign in to comment.