Files
swupd-client/test/functional/bundleremove/remove-include.bats
Castulo Martinez e419e7fa9d Refactor bundle-remove to include improvements
This commit does a major refactor of the bundle-remove command to
include these improvements:

- Adds a "--force" flag that can be used to remove a bundle that is
required by other installed bundles along with all the bundles that
depend on it
- When attempting to remove a bundle which is required by other
installed bundles, swupd used to show the list of dependencies in a tree
view, this list was very large in some cases. This commit changes the
output of such cases from a tree view to a simple deduplicated list of
bundles that require the bundle to be removed. The user can still see
the old tree view by including the --verbose when running the command
- Stops notifying telemetry of user errors, like user trying to remove
an invalid bundle, or a bundle that was not installed, etc
- Consider all bundles provided in the bundle-remove command when
checking for dependencies (required by)
- Instead of removing each bundle in the command one by one, consolidate
all bundles to be removed, validate them and remove them all at once.
This will optimize the tasks to be executed for removing bundles.

One change included in this commit for bundle-remove is propagated to
bundle-list:

- When using "bundle-list -D BUNDLE" to find what bundles depend on
BUNDLE. The list will be presented in a simplified deduplicated list of
dependencies by default instead of the tree view that used to be
default. The user can still see the old tree view by running the command
appending the --verbose flag

Closes #891
Closes #732
Closes #674

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-09-30 14:40:01 -07:00

35 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bats
load "../testlib"
test_setup() {
create_test_environment "$TEST_NAME"
create_bundle -L -n test-bundle1 -f /foo/test-file1 "$TEST_NAME"
create_bundle -L -n test-bundle2 -f /bar/test-file2 "$TEST_NAME"
# add test-bundle1 as dependency of test-bundle2
add_dependency_to_manifest "$WEBDIR"/10/Manifest.test-bundle2 test-bundle1
}
@test "REM010: Try removing a bundle that is a dependency of another bundle" {
run sudo sh -c "$SWUPD bundle-remove $SWUPD_OPTS test-bundle1"
assert_status_is "$SWUPD_REQUIRED_BUNDLE_ERROR"
assert_file_exists "$TARGETDIR"/usr/share/clear/bundles/test-bundle1
assert_file_exists "$TARGETDIR"/usr/share/clear/bundles/test-bundle2
assert_file_exists "$TARGETDIR"/foo/test-file1
assert_file_exists "$TARGETDIR"/bar/test-file2
expected_output=$(cat <<-EOM
Bundle "test-bundle1" is required by the following bundles:
- test-bundle2
Error: Bundle "test-bundle1" is required by 1 bundle, skipping it...
Use "swupd bundle-remove --force test-bundle1" to remove "test-bundle1" and all bundles that require it
Failed to remove 1 of 1 bundles
EOM
)
assert_is_output "$expected_output"
}