From 3b324ca62004b8ed56c3cba3ebdf61ef97b66324 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 9 Apr 2014 22:15:36 +0000 Subject: Remove NoObject reply, and adapt BackupQueries accordingly. --- test/bbackupd/testbbackupd.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test') diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index 827e3ea0..46289808 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -888,6 +888,34 @@ int test_bbackupd() client->QueryFinished(); } + printf("\n==== Testing that GetObject on nonexistent file outputs the " + "correct error message\n"); + { + std::auto_ptr connection = ConnectAndLogin( + context, 0 /* read-write */); + std::string errs; + std::auto_ptr config( + Configuration::LoadAndVerify + ("testfiles/bbackupd.conf", &BackupDaemonConfigVerify, errs)); + BackupQueries query(*connection, *config, false); // read-only + std::vector args; + args.push_back("2"); // object ID + args.push_back("testfiles/2.obj"); // output file + bool opts[256]; + + Capture capture; + Logging::TempLoggerGuard guard(&capture); + query.CommandGetObject(args, opts); + std::vector messages = capture.GetMessages(); + TEST_THAT(!messages.empty()); + if (!messages.empty()) + { + std::string last_message = messages.back().message; + TEST_EQUAL("Object ID 0x2 does not exist on store.", + last_message); + } + } + // unpack the files for the initial test TEST_THAT(::system("rm -rf testfiles/TestDir1") == 0); TEST_THAT(::mkdir("testfiles/TestDir1", 0777) == 0); -- cgit v1.2.3