Files
swupd-client/test/functional/update/update-verify-fix-path-missing-dir.bats
Castulo Martinez a562fb4fd3 Implement --file option for diagnose/repair
When diagnosing/repairing a system, sometimes is useful to only
diagnose/repair a specific file or path.

This commit implements the --file option for diagnose/repair so a file
or path can be diagnosed only instead of doing it to the whole OS or a
whole bundle.

Closes #1150

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-01-28 15:01:47 -08:00

53 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bats
load "../testlib"
test_setup() {
create_test_environment "$TEST_NAME"
create_bundle -L -n test-bundle -f /foo/bar/baz/test-file "$TEST_NAME"
# remove the foo dir
sudo rm -rf "$TARGETDIR"/foo
create_version "$TEST_NAME" 100 10
update_bundle "$TEST_NAME" test-bundle --update /foo/bar/baz/test-file
}
@test "UPD029: Update corrects a missing directory in the target system" {
run sudo sh -c "$SWUPD update $SWUPD_OPTS"
assert_status_is 0
expected_output=$(cat <<-EOM
Update started
Preparing to update from 10 to 100
Downloading packs for:
- test-bundle
Finishing packs extraction...
Warning: Couldn.t use delta file .*
Statistics for going from version 10 to version 100:
changed bundles : 1
new bundles : 0
deleted bundles : 0
changed files : 1
new files : 0
deleted files : 0
Validate downloaded files
Starting download of remaining update content. This may take a while...
Installing files...
-> Missing directory: $PATH_PREFIX/foo -> fixed
-> Missing directory: $PATH_PREFIX/foo/bar -> fixed
-> Missing directory: $PATH_PREFIX/foo/bar/baz -> fixed
Update was applied
Calling post-update helper scripts
1 files were not in a pack
Update successful - System updated from version 10 to version 100
EOM
)
assert_regex_is_output "$expected_output"
assert_dir_exists "$TARGETDIR"/foo/bar/baz
assert_file_exists "$TARGETDIR"/foo/bar/baz/test-file
}