summaryrefslogtreecommitdiff
path: root/lib/backupstore/StoreTestUtils.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-09-04 01:35:59 +0000
committerChris Wilson <chris+github@qwirx.com>2014-09-04 01:35:59 +0000
commit75ad60bcc4d33589bb5afb307a87fd19b220a9e8 (patch)
tree52ca7181df6248be83c9c2337b12e42fd228defe /lib/backupstore/StoreTestUtils.h
parent1f1d8355ad73eb9c0ab9aaeb069a21aecee78d6f (diff)
Define some functions to reduce duplication in testbbackupd.
Merged back changes from the test refactor branch to reduce diffs. Fix wrong setting of log level in compare() function. We want to only show errors if we expect mismatches, and show warnings if we didn't expect mismatches. I had it the other way around before.
Diffstat (limited to 'lib/backupstore/StoreTestUtils.h')
-rw-r--r--lib/backupstore/StoreTestUtils.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/backupstore/StoreTestUtils.h b/lib/backupstore/StoreTestUtils.h
index 197a3345..2fc7ca64 100644
--- a/lib/backupstore/StoreTestUtils.h
+++ b/lib/backupstore/StoreTestUtils.h
@@ -30,7 +30,10 @@ extern int bbstored_pid;
bool setUp(const char* function_name);
//! Checks account for errors and shuts down daemons at end of every test.
-void tearDown();
+bool tearDown();
+
+//! Like tearDown() but returns false, because a test failure was detected.
+bool fail();
//! Sets the expected refcount of an object, resizing vector if necessary.
void set_refcount(int64_t ObjectID, uint32_t RefCount = 1);
@@ -42,9 +45,12 @@ void init_context(TLSContext& rContext);
std::auto_ptr<SocketStream> open_conn(const char *hostname,
TLSContext& rContext);
+//! Opens a connection to the server (bbstored) without logging in.
+std::auto_ptr<BackupProtocolCallable> connect_to_bbstored(TLSContext& rContext);
+
//! Opens a connection to the server (bbstored) and logs in.
-std::auto_ptr<BackupProtocolCallable> test_server_login(const char *hostname,
- TLSContext& rContext, int flags = 0);
+std::auto_ptr<BackupProtocolCallable> connect_and_login(TLSContext& rContext,
+ int flags = 0);
//! Checks the number of files of each type in the store against expectations.
bool check_num_files(int files, int old, int deleted, int dirs);
@@ -53,6 +59,9 @@ bool check_num_files(int files, int old, int deleted, int dirs);
bool check_num_blocks(BackupProtocolCallable& Client, int Current, int Old,
int Deleted, int Dirs, int Total);
+//! Change the soft and hard limits on the test account.
+bool change_account_limits(const char* soft, const char* hard);
+
//! Checks an account for errors, returning the number of errors found and fixed.
int check_account_for_errors(Log::Level log_level = Log::WARNING);