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

45 lines
1.7 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 /file_1 "$TEST_NAME"
}
@test "REM020: Removing a bundle using machine readable output" {
# the --json-output flag can be used so all the output of the bundle-remove
# command is created as a JSON stream that can be read and parsed by other
# applications interested into knowing real time status of the command
run sudo sh -c "$SWUPD bundle-remove --json-output $SWUPD_OPTS_PROGRESS test-bundle"
assert_status_is 0
expected_output=$(cat <<-EOM
[
{ "type" : "start", "section" : "bundle-remove" },
{ "type" : "progress", "currentStep" : 1, "totalSteps" : 2, "stepCompletion" : -1, "stepDescription" : "load_manifests" },
{ "type" : "info", "msg" : " The following bundles are being removed:" },
{ "type" : "info", "msg" : " - test-bundle" },
{ "type" : "info", "msg" : " Deleting bundle files..." },
{ "type" : "progress", "currentStep" : 1, "totalSteps" : 2, "stepCompletion" : 100, "stepDescription" : "load_manifests" },
{ "type" : "progress", "currentStep" : 2, "totalSteps" : 2, "stepCompletion" : 0, "stepDescription" : "remove_files" },
{ "type" : "progress", "currentStep" : 2, "totalSteps" : 2, "stepCompletion" : 50, "stepDescription" : "remove_files" },
{ "type" : "progress", "currentStep" : 2, "totalSteps" : 2, "stepCompletion" : 100, "stepDescription" : "remove_files" },
{ "type" : "info", "msg" : "Total deleted files: 2" },
{ "type" : "info", "msg" : " Successfully removed 1 bundle" },
{ "type" : "end", "section" : "bundle-remove", "status" : 0 }
]
EOM
)
assert_is_output "$expected_output"
}
#WEIGHT=2