Skip to content

Commit

Permalink
Merge pull request os-autoinst#20724 from rewenila/feature/ai-stack-r…
Browse files Browse the repository at this point in the history
…bac-tests-wrapper

Add wrapper script for AI stack RBAC test cases
  • Loading branch information
asmorodskyi authored Dec 16, 2024
2 parents 7c3e460 + be4ec76 commit 75eaee1
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
Binary file added data/aistack/open-webui-rbac-tests.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/main_micro_alp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ sub load_slem_on_pc_tests {
# AISTACK test verification
loadtest("publiccloud/ssh_interactive_start", run_args => $args);
loadtest("publiccloud/create_aistack_env", run_args => $args);
loadtest("publiccloud/aistack_rbac_run", run_args => $args);
loadtest("publiccloud/ssh_interactive_end", run_args => $args);
#loadtest("publiccloud/<saintytest>", run_args => $args);
#loadtest("publiccloud/<rbac>", run_args => $args);
} elsif (is_container_test) {
loadtest("publiccloud/ssh_interactive_start", run_args => $args);
loadtest("publiccloud/instance_overview", run_args => $args);
Expand Down
52 changes: 52 additions & 0 deletions tests/publiccloud/aistack_rbac_run.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SUSE's openQA tests
#
# Copyright 2024 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Open WebUI RBAC tests

# Summary: This test creates a Python virtual env, install requirements, and run the
# Open WebUI RBAC tests with pytest, in the test environment created by create_aistack_env.
# Maintainer: Aline Werner <[email protected]>
# Ticket: https://jira.suse.com/browse/SUSEAI-22

use Mojo::Base 'publiccloud::basetest';
use strict;
use warnings;
use testapi;
use utils;
use publiccloud::utils;
use version_utils;
use transactional qw(trup_call);

sub test_flags {
return {fatal => 1, publiccloud_multi_module => 1};
}

sub run {
my ($self, $args) = @_;

my $instance = $args->{my_instance};
my $provider = $args->{my_provider};

# Get Open WebUI tests location and admin credentials
my $rbac_tests_archive = get_required_var('OPENWEBUI_RBAC_TESTS_ARCHIVE');
my $rbac_tests_url = data_url("aistack/" . $rbac_tests_archive);
my $admin_email = get_var('OPENWEBUI_ADMIN_EMAIL');
my $admin_password = get_var('OPENWEBUI_ADMIN_PWD');
record_info("Got Open WebUI admin credentials: $admin_email and $admin_password.");
assert_script_run("export OPENWEBUI_ADMIN_EMAIL=$admin_email OPENWEBUI_ADMIN_PWD=$admin_password");

# Install requirements and call tests
trup_call("pkg install python311");
assert_script_run("curl -O " . $rbac_tests_url);
assert_script_run("mkdir -p open-webui-rbac-tests && tar -xzvf $rbac_tests_archive -C open-webui-rbac-tests && cd open-webui-rbac-tests");
assert_script_run("python3.11 -m venv myenv");
assert_script_run("source myenv/bin/activate");
assert_script_run("pip3 install -r requirements.txt");
assert_script_run("cp .env.example .env");
assert_script_run("pytest -vv --ENV remote tests");
record_info("End of RBAC tests.");
}

1;

0 comments on commit 75eaee1

Please sign in to comment.