@@ -146,12 +146,16 @@ function installation_test() {
146146function autoupdate_test() {
147147 _show_function_title " Running autoupdate test ..."
148148
149+ _show_updated_message " Creating temporary vuh src analog ..."
149150 tmp_vuh_src_dir=' /opt/old_vuh_simulation'
150151 mkdir -p " $tmp_vuh_src_dir " || exit 1
151- ls -la " $VUH_SRC_VOLUME "
152152 cp -r " $VUH_SRC_VOLUME /." " $tmp_vuh_src_dir " || exit 1
153- ls -la " $tmp_vuh_src_dir "
154- # TODO downgrade versions
153+
154+ _show_updated_message " Creating downgraded version of repository ..."
155+ change_line=" VUH_VERSION='"
156+ line_with_downgraded_version=" VUH_VERSION='1.0.0'"
157+ downgraded_vuh_file=" $( sed " s/VUH_VERSION=.*/VUH_VERSION=\'1\.0\.0\'/" " $tmp_vuh_src_dir /vuh.sh" ) "
158+ echo " $downgraded_vuh_file " > " $tmp_vuh_src_dir /vuh.sh"
155159
156160 _show_updated_message " Installing vuh using installer.sh .."
157161 " .$tmp_vuh_src_dir /installer.sh" -d
@@ -161,18 +165,26 @@ function autoupdate_test() {
161165 git clone " $VUH_REPO_ADDRESS " " $repo_name "
162166 cd " $repo_name " || exit 1
163167
164- # TODO check update required
165-
166- # TODO start update
167-
168- _show_updated_message " Trying to update vuh manually (when update not required) ..."
169- expecting_already_updated=' you already have the latest vuh version'
170- vuh_update_output=" $( vuh --update) " || exit 1
171- if ! [[ $vuh_update_output =~ $expecting_already_updated ]]; then
172- _show_error_message " Update command failed!"
173- _show_error_message " $vuh_update_output "
174- exit 1
175- fi
168+ _show_updated_message " Checking vuh installed correctly (downgraded version 1.0.0) ..."
169+ vuh -v || exit 1
170+
171+ _show_updated_message " Check autoupdate initialized ..."
172+ " ./../autoupdate.exp" || exit 1
173+
174+ _show_updated_message " Checking vuh updated correctly (downgraded version 1.0.0) ..."
175+ vuh -v || exit 1
176+ [ " $( vuh -v) " != ' 1.0.0' ] || exit 1
177+
178+ # TODO uncomment in next release
179+ # _show_updated_message "Trying to update vuh manually (when update not required) ..."
180+ # expecting_already_updated='you already have the latest vuh version'
181+ # vuh_update_output="$(vuh --update)" || exit 1
182+ # echo "vuh_update_output: $vuh_update_output"
183+ # if ! [[ $vuh_update_output =~ $expecting_already_updated ]]; then
184+ # _show_error_message "Update command failed!"
185+ # _show_error_message "$vuh_update_output"
186+ # exit 1
187+ # fi
176188
177189 _show_success_message " Autoupdate tests successfully finished."
178190}
0 commit comments