]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Add regress tests for metaplugin accurate get feature.
authorRadosław Korzeniewski <radoslaw@korzeniewski.net>
Mon, 30 Aug 2021 08:02:38 +0000 (10:02 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:03 +0000 (09:03 +0100)
bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c
regress/scripts/metaplugin-protocol-tests.sh

index 12ed7450da1d6f100f7477378495c2bbdb022c63..3badc2114c210df9a3e2795fd6031fc120704707 100644 (file)
@@ -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
index 622d719414c7cb7ff23166e7bb143016026853f2..45687e8f07b20675de3ee2cb4c4839ebb0b6d5b0 100755 (executable)
@@ -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