From acd2b8b241ecf7e43e1659cd4ac878302c7a20f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Korzeniewski?= Date: Tue, 13 Apr 2021 15:07:57 +0200 Subject: [PATCH] metaplugin: Update regression tests. --- .../fd/pluginlib/test_metaplugin_backend.c | 9 +++++ regress/scripts/metaplugin-protocol-tests.sh | 33 +++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c b/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c index ff683e719..c97c03c8d 100644 --- a/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c +++ b/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c @@ -697,6 +697,7 @@ void perform_restore(){ bool loopgo = true; bool restore_skip_create = false; bool restore_with_core = false; + bool restore_skip_metadata = false; if (regress_error_restore_stderr) { // test some stderror handling @@ -734,6 +735,7 @@ void perform_restore(){ if (strncmp(buf, "FNAME:", 6) == 0) { restore_with_core = strstr(buf, "/_restore_with_core/") != NULL && strstr(buf, "/etc/issue") != NULL; restore_skip_create = strstr(buf, "/_restore_skip_create/") != NULL; + restore_skip_metadata = strstr(buf, "/_restore_skip_metadata/") != NULL; /* we read here a file parameters */ while (read_plugin(buf) > 0); @@ -764,6 +766,13 @@ void perform_restore(){ read_plugin_data_stream(); /* signal OK */ LOG("#> METADATA_STREAM data saved."); + + if (restore_skip_metadata){ + write_plugin('I', "TEST5R - metadata select skip restore."); + write_plugin('C', "SKIP\n"); + continue; + } + write_plugin('I', "TEST5R - metadata saved."); write_plugin('C', "OK\n"); continue; diff --git a/regress/scripts/metaplugin-protocol-tests.sh b/regress/scripts/metaplugin-protocol-tests.sh index 9876f4088..d0fdeaa53 100755 --- a/regress/scripts/metaplugin-protocol-tests.sh +++ b/regress/scripts/metaplugin-protocol-tests.sh @@ -238,6 +238,26 @@ END_OF_DATA run_bconsole +# restore with metadata skip +cat <${cwd}/tmp/bconcmds +@# +@# Restore +@# +@output /dev/null +messages +@$out ${cwd}/tmp/rlog5.out +setdebug level=500 client=$CLIENT trace=1 +restore fileset=$FilesetBackup5 where=${cwd}/tmp/_restore_skip_metadata/ select all storage=File done +yes +wait +messages +llist job=RestoreFiles +@output +quit +END_OF_DATA + +run_bconsole + # and finally test listing mode TEST=1 for ppath in / containers containers/bucket1 containers/bucket2 @@ -372,10 +392,19 @@ RET=$(grep "jobstatus:" ${cwd}/tmp/rlog4.out | tail -1 | awk '{print $2}') REND=$(grep -w -c "TESTEND" ${cwd}/tmp/rlog4.out) diff ${cwd}/tmp/_restore_with_core/*/bucket/*/etc/issue /etc/issue > /dev/null 2>&1 RDIFF=$? -if [ "x$RET" != "xT" ] || [ "$REND" -ne 1 ] || [ $RDIFF -ne 0 ] +if [ "x$RET" != "xT" ] || [ "$REND" -ne 1 ] || [ "$RDIFF" -ne 0 ] then - echo "rlog4" "$RET" "$REND" + echo "rlog4" "$RET" "$REND" "$RDIFF" rstat=4 fi +RET=$(grep "jobstatus:" ${cwd}/tmp/rlog5.out | tail -1 | awk '{print $2}') +REND=$(grep -w -c "TESTEND" ${cwd}/tmp/rlog5.out) +RSKIP=$(grep -c "metadata select skip restore" ${cwd}/tmp/rlog5.out) +if [ "x$RET" != "xT" ] || [ "$REND" -ne 1 ] || [ "$RSKIP" -ne 1 ] +then + echo "rlog5" "$RET" "$REND" "$RSKIP" + rstat=5 +fi + end_test -- 2.47.3