Files
swupd-client/test/functional/bundlelist/list-json.bats
Castulo Martinez db033b1d6b Show spinner when loading manifests in bundle-list
For some options of bundle-list, like --deps and --has-dep, we sometimes
need to download a considerable amount of manifests, if that happens
swupd just seems to hang for some time, this time could be considerably
in slow networks.

This commit enables the spinner while the manifests are baing downloaded
during a bundle-list operation so users know swupd is not hung and it is
doing some downloading.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-03 14:29:11 -08:00

44 lines
1.5 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 "LST019: Listing bundles using machine readable output" {
# the --json-output flag can be used so all the output of the bundle-list
# 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-list --json-output $SWUPD_OPTS_PROGRESS"
assert_status_is 0
expected_output=$(cat <<-EOM
[
{ "type" : "start", "section" : "bundle-list" },
{ "type" : "progress", "currentStep" : 1, "totalSteps" : 2, "stepCompletion" : -1, "stepDescription" : "load_manifests" },
{ "type" : "progress", "currentStep" : 1, "totalSteps" : 2, "stepCompletion" : 100, "stepDescription" : "load_manifests" },
{ "type" : "progress", "currentStep" : 2, "totalSteps" : 2, "stepCompletion" : -1, "stepDescription" : "list_bundles" },
{ "type" : "info", "msg" : "Installed bundles:" },
{ "type" : "info", "msg" : " -" },
{ "type" : "info", "msg" : "os-core" },
{ "type" : "info", "msg" : " -" },
{ "type" : "info", "msg" : "test-bundle" },
{ "type" : "info", "msg" : " Total: 2" },
{ "type" : "progress", "currentStep" : 2, "totalSteps" : 2, "stepCompletion" : 100, "stepDescription" : "list_bundles" },
{ "type" : "end", "section" : "bundle-list", "status" : 0 }
]
EOM
)
assert_is_output "$expected_output"
}