Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions lib/engines/functest/functest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def initialize(project)
@project.append_multilog("#{project.engine_tag}.log")
@config = load_engine_config
@drivers = load_drivers
@tests = init_tests
prepare_extra_sw
Comment thread
kostyanf14 marked this conversation as resolved.
@logger.info('Functest engine initialized')
end
Expand Down Expand Up @@ -59,13 +60,16 @@ def clients_system_info
{}
end

# rubocop:disable Metrics/AbcSize
def run
@logger.info('Starting functest engine')

def init_tests
loader = Functest::TestLoader.new(@project, @config['test_definitions_path'])
tests = load_tests(loader)
@logger.info("Total tests to run: #{tests.length}")
tests
end

# rubocop:disable Metrics/AbcSize
def run
@logger.info('Starting functest engine')

ResourceScope.open do |scope|
client = @project.setup_manager.run_functest_client(scope, client_name)
Expand All @@ -74,7 +78,7 @@ def run
@executor = Functest::TestExecutor.new(@project, client,
default_timeout: @config['default_timeout'])
setup_test_context(@executor.context)
summary = @executor.execute_tests(tests)
summary = @executor.execute_tests(@tests)

generate_results(summary)
summary[:failed].zero? ? 0 : 1
Expand Down Expand Up @@ -110,9 +114,9 @@ def load_tests(loader)
def test_names_and_static_rejects(loader)
test_options = @project.options.test
if test_options.category
suite = loader.load_suite(test_options.category)
@logger.info("Loaded test suite: #{suite.name}")
[suite.tests, suite.reject_test_names]
@suite = loader.load_suite(test_options.category)
@logger.info("Loaded test suite: #{@suite.name}")
[@suite.tests, @suite.reject_test_names]
elsif test_options.testcase
[test_options.testcase.split(',').map(&:strip), []]
else
Expand Down Expand Up @@ -191,6 +195,7 @@ def skip_driver?(driver)
def prepare_extra_sw
extra_softwares = @drivers.flat_map(&:extra_software)
extra_softwares += @project.engine_platform.extra_software
extra_softwares += @suite.requirements.extra_software if @suite
Comment thread
kostyanf14 marked this conversation as resolved.

Comment thread
kostyanf14 marked this conversation as resolved.
@project.extra_sw_manager.prepare_software_packages(
extra_softwares, @project.engine_platform.kit, ENGINE_MODE
Expand Down
3 changes: 2 additions & 1 deletion lib/engines/functest/suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class SuiteRequirements < T::Struct

const :drivers, T::Array[String], default: []
const :platforms, T::Array[String], default: []
const :extra_software, T::Array[String], default: []
end

# Sorbet model for a functest suite JSON file
Expand All @@ -20,7 +21,7 @@ class Suite < T::Struct
const :description, T.nilable(String)
const :test_system_ref, T.nilable(String)
const :tests, T::Array[String]
const :requirements, T.nilable(SuiteRequirements)
const :requirements, SuiteRequirements, factory: -> { SuiteRequirements.new }
Comment thread
kostyanf14 marked this conversation as resolved.
const :reject_test_names, T::Array[String], default: []
end
end
Expand Down
Loading