Skip to content

Commit

Permalink
Included Private ai stack basic sanity test
Browse files Browse the repository at this point in the history
  • Loading branch information
yarunachalam committed Aug 22, 2024
1 parent 64adb69 commit ba071b1
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions tests/publiccloud/aistack_basic.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
use Mojo::Base 'publiccloud::basetest';

Check failure on line 1 in tests/publiccloud/aistack_basic.pm

View workflow job for this annotation

GitHub Actions / CI: Running static tests with perl v5.32

File tests/publiccloud/aistack_basic.pm needs tidying
use testapi;
use serial_terminal 'select_serial_terminal';
use publiccloud::utils qw(is_byos registercloudguest register_openstack);
use publiccloud::ssh_interactive 'select_host_console';
use strict;
use warnings;
use utils;
use publiccloud::utils;
use File::Basename;

sub run {
my ($self, $args) = @_;
#Download unpublished DMS package and install rpm
my $ins_rke2 = get_var('RKE2_URL');
my $ins_kubectl = get_var('KUBECTL_URL');
my $ins_helm = get_var('HELM_URL');
#my $add_repo = get_var('HELM_REPO');


#Create aws instance
my $provider;
my $instance;
select_host_console();

my $aws_test = get_var('PUBLIC_CLOUD_AWS_TEST', 'basic_sanity');
if ($aws_test) {
$instance = $self->{my_instance} = $args->{my_instance};
$provider = $self->{provider} = $args->{my_provider}; # required for cleanup
} else {
$provider = $self->{provider} = $self->provider_factory(); # required for cleanup
$instance = $self->{my_instance} = $provider->create_instance(check_guestregister => is_openstack ? 0 : 1);
}

registercloudguest($instance) if is_byos();

#Update and install dependencies
$instance->ssh_assert_script_run('sudo zypper ref; sudo zypper -n up',
timeout => 1000);
record_info('Refresh and update');
sleep 90; # wait for a bit for zypper to be available

#Install Docker (required for RKE2)

$instance->ssh_assert_script_run('sudo transactional-update -n pkg install -y curl',
timeout => 100);
$instance->ssh_assert_script_run('sudo transactional-update -n pkg install -y docker',
timeout => 100);
$instance->ssh_assert_script_run('sudo systemctl start docker',
timeout => 100);
$instance->ssh_assert_script_run('sudo systemctl enable docker',
timeout => 100);
$instance->ssh_assert_script_run('sudo systemctl status docker',
timeout => 100);
record_info('Installed Docker');

#Install RKE2
$instance->ssh_assert_script_run('curl -sfL $ins_rke2 | sh',
timeout => 1000);
$instance->ssh_assert_script_run('sudo systemctl enable rke2-server',
timeout => 100);
$instance->ssh_assert_script_run('sudo systemctl start rke2-server',
timeout => 100);
$instance->ssh_assert_script_run('sudo systemctl status rke2-server',
timeout => 100);
record_info('Installed RKE2');

#Install kubectl
$instance->ssh_assert_script_run(
'curl -LO $ins_kubectl',
timeout => 1000);
$instance->ssh_assert_script_run('chmod +x ./kubectl', timeout => 100);
$instance->ssh_assert_script_run(
'sudo mv ./kubectl /usr/local/bin/kubectl',
timeout => 100);
$instance->ssh_assert_script_run('kubectl version --client',
timeout => 100);
record_info('RKE2 setup is complete');

#Install Helm and private-ai-charts repo

$instance->ssh_assert_script_run(
'curl $ins_helm | bash',
timeout => 1000
);
record_info('helm private-ai-chart install complete');
}

1;

0 comments on commit ba071b1

Please sign in to comment.