summaryrefslogtreecommitdiff
path: root/test/backupstore
diff options
context:
space:
mode:
Diffstat (limited to 'test/backupstore')
-rw-r--r--test/backupstore/testbackupstore.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/backupstore/testbackupstore.cpp b/test/backupstore/testbackupstore.cpp
index 8fe76473..d17ed56f 100644
--- a/test/backupstore/testbackupstore.cpp
+++ b/test/backupstore/testbackupstore.cpp
@@ -781,6 +781,45 @@ int64_t create_directory(BackupProtocolCallable& protocol,
int64_t create_file(BackupProtocolCallable& protocol, int64_t subdirid,
const std::string& remote_filename = "");
+bool run_housekeeping_and_check_account(BackupProtocolLocal2& protocol)
+{
+ protocol.QueryFinished();
+ bool check_account_status;
+ TEST_THAT(check_account_status = run_housekeeping_and_check_account());
+ bool check_refcount_status;
+ TEST_THAT(check_refcount_status = check_reference_counts());
+ protocol.Reopen();
+ return check_account_status & check_refcount_status;
+}
+
+bool test_temporary_refcount_db_is_independent()
+{
+ SETUP();
+
+ std::auto_ptr<BackupStoreAccountDatabase> apAccounts(
+ BackupStoreAccountDatabase::Read("testfiles/accounts.txt"));
+ std::auto_ptr<BackupStoreRefCountDatabase> temp(
+ BackupStoreRefCountDatabase::Create(
+ apAccounts->GetEntry(0x1234567)));
+ std::auto_ptr<BackupStoreRefCountDatabase> perm(
+ BackupStoreRefCountDatabase::Load(
+ apAccounts->GetEntry(0x1234567),
+ false // readonly
+ ));
+
+ TEST_CHECK_THROWS(temp->GetRefCount(2),
+ BackupStoreException, UnknownObjectRefCountRequested);
+ TEST_CHECK_THROWS(perm->GetRefCount(2),
+ BackupStoreException, UnknownObjectRefCountRequested);
+ temp->AddReference(2);
+ TEST_EQUAL(1, temp->GetRefCount(2));
+ TEST_CHECK_THROWS(perm->GetRefCount(2),
+ BackupStoreException, UnknownObjectRefCountRequested);
+ temp->Discard();
+
+ return teardown_test_backupstore();
+}
+
bool test_server_housekeeping()
{
SETUP();
@@ -3039,6 +3078,7 @@ int test(int argc, const char *argv[])
}
TEST_THAT(test_filename_encoding());
+ TEST_THAT(test_temporary_refcount_db_is_independent());
TEST_THAT(test_bbstoreaccounts_create());
TEST_THAT(test_bbstoreaccounts_delete());
TEST_THAT(test_backupstore_directory());