Files
Otavio Pontes d61288464d tests: Auto rebalance tests based on how long they take to long
This patch adds 2 scripts used to balance test execution. The weight_tests.bash
runs all tests and sets a weight to them based on how long they take to run. The
other, filter_bats_list.bash, use this information to split the tests in groups to
be executed by github actions.
When a new test is added the script will consider it with an average weight, so this
shouldn't unbalance the system right away. After some time, if we notice that the
system is not balanced anymore we can just run the weight_tests.bash again to rebalance.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-02-20 13:22:31 -08:00

61 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bats
# Author: Castulo Martinez
# Email: castulo.martinez@intel.com
load "../testlib"
test_setup() {
create_test_environment "$TEST_NAME"
create_bundle -L -n test-bundle -f /foo "$TEST_NAME"
create_version "$TEST_NAME" 20 10
update_bundle "$TEST_NAME" test-bundle --update /foo
}
@test "UPD055: Update a system showing detailed operation time" {
run sudo sh -c "$SWUPD update $SWUPD_OPTS --time"
assert_status_is 0
expected_output=$(cat <<-EOM
Raw elapsed time stats:
.* ms: Total execution time
.* ms: |-- Prepare for update
.* ms: |-- Get versions
.* ms: |-- Clean up download directory
.* ms: |-- Load manifests
.* ms: |-- Load MoM manifests
.* ms: |-- Recurse and consolidate bundle manifests
.* ms: |-- Add included bundle manifests
.* ms: |-- Run pre-update scripts
.* ms: |-- Download packs
.* ms: |-- Apply deltas
.* ms: |-- Create update list
.* ms: |-- Update loop
.* ms: |-- Run post-update scripts
CPU process time stats:
.* ms: Total execution time
.* ms: |-- Prepare for update
.* ms: |-- Get versions
.* ms: |-- Clean up download directory
.* ms: |-- Load manifests
.* ms: |-- Load MoM manifests
.* ms: |-- Recurse and consolidate bundle manifests
.* ms: |-- Add included bundle manifests
.* ms: |-- Run pre-update scripts
.* ms: |-- Download packs
.* ms: |-- Apply deltas
.* ms: |-- Create update list
.* ms: |-- Update loop
.* ms: |-- Run post-update scripts
Update successful - System updated from version 10 to version 20
EOM
)
assert_regex_in_output "$expected_output"
}
#WEIGHT=3