Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 3338cb2

Browse files
William Douglasbryteise
authored andcommitted
Rework clean-old-statedir test output checking
The order of files in this test aren't very completely stable so make do with looking at output chunks that seem to be reasonably consistent across different environments. Signed-off-by: William Douglas <[email protected]>
1 parent 7f59817 commit 3338cb2

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

test/functional/clean/clean-old-statedir.bats

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test_setup() {
3232

3333
# 3rd-party has both, data and cache
3434

35-
#
35+
#
3636
# ├── 3rd-party
3737
#
3838

@@ -106,31 +106,47 @@ test_setup() {
106106
run sudo sh -c "$SWUPD clean $SWUPD_OPTS --dry-run"
107107

108108
assert_status_is "$SWUPD_OK"
109+
assert_in_output "$ABS_DELTA_DIR"
110+
assert_in_output "$ABS_DOWNLOAD_DIR"
111+
assert_in_output "$ABS_STAGED_DIR"
112+
assert_in_output "$ABS_TEMP_DIR"
113+
assert_in_output "$ABS_STATE_DIR/pack-vim-from-32800-to-32900.tar"
114+
assert_in_output "$ABS_STATE_DIR/Manifest-emacs-delta-from-32900-to-33000"
115+
assert_in_output "$ABS_STATE_DIR/staged"
116+
assert_in_output "$ABS_STATE_DIR/delta"
117+
assert_in_output "$ABS_STATE_DIR/download"
118+
assert_in_output "$ABS_STATE_DIR/32900"
119+
assert_in_output "$ABS_STATE_DIR/33000"
120+
109121
expected_output=$(cat <<-EOM
110-
$ABS_DELTA_DIR
111-
$ABS_DOWNLOAD_DIR
112-
$ABS_STAGED_DIR
113-
$ABS_TEMP_DIR
114-
$ABS_STATE_DIR/pack-vim-from-32800-to-32900.tar
115-
$ABS_STATE_DIR/Manifest-emacs-delta-from-32900-to-33000
116122
$ABS_STATE_DIR/staged/.*
117123
$ABS_STATE_DIR/staged/.*
118-
$ABS_STATE_DIR/staged
119-
$ABS_STATE_DIR/delta
120-
$ABS_STATE_DIR/download
124+
EOM
125+
)
126+
assert_regex_in_output "$expected_output"
127+
128+
expected_output=$(cat <<-EOM
121129
$ABS_STATE_DIR/32900/Manifest\\..*
122130
$ABS_STATE_DIR/32900/Manifest\\..*
123-
$ABS_STATE_DIR/32900
131+
EOM
132+
)
133+
assert_regex_in_output "$expected_output"
134+
135+
expected_output=$(cat <<-EOM
124136
$ABS_STATE_DIR/33000/Manifest\\..*
125137
$ABS_STATE_DIR/33000/Manifest\\..*
126138
$ABS_STATE_DIR/33000/Manifest\\..*
127139
$ABS_STATE_DIR/33000/Manifest\\..*
128-
$ABS_STATE_DIR/33000
140+
EOM
141+
)
142+
assert_regex_in_output "$expected_output"
143+
144+
expected_output=$(cat <<-EOM
129145
Would remove 19 files
130146
Aproximatelly .* KB would be freed
131147
EOM
132148
)
133-
assert_regex_is_output "$expected_output"
149+
assert_regex_in_output "$expected_output"
134150

135151
# non of the files should be removed since it was just a dry run
136152
assert_file_exists "$MOM"

0 commit comments

Comments
 (0)