From: Radosław Korzeniewski Date: Mon, 30 Aug 2021 08:02:38 +0000 (+0200) Subject: regress: Add regress tests for metaplugin accurate get feature. X-Git-Tag: Release-11.3.2~363 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1beb683e7f9fea5519e12102d2dae05f1997d5d;p=thirdparty%2Fbacula.git regress: Add regress tests for metaplugin accurate get feature. --- diff --git a/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c b/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c index 12ed7450d..3badc2114 100644 --- a/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c +++ b/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c @@ -795,6 +795,33 @@ void perform_backup() if (strncmp(buf, "SEEN", 4) == 0) { seen = true; } + + // accurate check nonexistent file + snprintf(buf, BIGBUFLEN, "CHECK:%s/nonexistent/%d/file\n", PLUGINPREFIX, mypid); + write_plugin('C', buf); + write_plugin('C', "STAT:F 0 0 0 100640 1\n"); + write_plugin('C', "TSTAMP:0 0 0\n"); + read_plugin(buf); + if (strncmp(buf, "SEEN", 4) != 0) { + write_plugin('I', "TEST CHECK nonexistentok"); + } + + // now accurateGet query + write_plugin('C', "CHECKGET:/etc/passwd\n"); + read_plugin(buf); + if (strncmp(buf, "STAT", 4) == 0) { + // yes, the data is available + read_plugin(buf); + write_plugin('I', "TEST CHECKGET"); + } + + // accurate check nonexistent file + snprintf(buf, BIGBUFLEN, "CHECKGET:%s/nonexistent/%d/file\n", PLUGINPREFIX, mypid); + write_plugin('C', buf); + read_plugin(buf); + if (strncmp(buf, "UNAVAIL", 7) == 0) { + write_plugin('I', "TEST CHECK nonexistentok"); + } } // backup if full or not seen diff --git a/regress/scripts/metaplugin-protocol-tests.sh b/regress/scripts/metaplugin-protocol-tests.sh index 622d71941..45687e8f0 100755 --- a/regress/scripts/metaplugin-protocol-tests.sh +++ b/regress/scripts/metaplugin-protocol-tests.sh @@ -526,9 +526,10 @@ fi RET=$(grep "jobstatus:" ${cwd}/tmp/log10.out | awk '{print $2}') SEEN=$(grep -c "SEEN" ${cwd}/tmp/log10.out) -if [ "x$RET" != "xT" ] || [ "$SEEN" -ne 1 ] +NONEXIST=$(grep -c "nonexistentok" ${cwd}/tmp/log10.out) +if [ "x$RET" != "xT" ] || [ "$SEEN" -ne 1 ] || [ "$NONEXIST" -ne 2 ] then - echo "log10" "$RET" "$SEEN" + echo "log10" "$RET" "$SEEN" "$NONEXIST" bstat=$((bstat+512)) fi