diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-12-26 23:17:09 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-12-26 23:17:09 +0000 |
commit | ee435505649c94fcf3908c8745df7fe9fed44b9d (patch) | |
tree | ced8f595916b0471b25b4406dd71a30e07bf741e | |
parent | e3d2f96ec6611d9c9b0055bb5ac7ba1f1c5dafe1 (diff) |
Fix test failures caused by connections left open on Windows.
-rw-r--r-- | test/bbackupd/testbbackupd.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index c862c636..ea29a12b 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -1376,19 +1376,18 @@ bool test_backup_disappearing_directory() &bbackupd); params.mSyncPeriodEnd = GetCurrentBoxTime(); - BackupProtocolCallable& connection = clientContext.GetConnection(); - BackupClientFileAttributes attr; attr.ReadAttributes("testfiles/TestDir1", false /* put mod times in the attributes, please */); std::auto_ptr<IOStream> attrStream(new MemBlockStream(attr)); BackupStoreFilenameClear dirname("Test1"); std::auto_ptr<BackupProtocolSuccess> - dirCreate(connection.QueryCreateDirectory( + dirCreate(clientContext.GetConnection().QueryCreateDirectory( BACKUPSTORE_ROOT_DIRECTORY_ID, // containing directory 0, // attrModTime, dirname, // dirname, attrStream)); + clientContext.CloseAnyOpenConnection(); // Object ID for later creation int64_t oid = dirCreate->GetObjectID(); @@ -1402,7 +1401,7 @@ bool test_backup_disappearing_directory() "testfiles/TestDir1", // locationPath, "/whee", // remotePath fakeLocation); - + clientContext.CloseAnyOpenConnection(); TEST_COMPARE(Compare_Same); // Run another backup, check that we haven't got an inconsistent @@ -1412,6 +1411,7 @@ bool test_backup_disappearing_directory() "testfiles/TestDir1", // locationPath, "/whee", // remotePath fakeLocation); + clientContext.CloseAnyOpenConnection(); TEST_COMPARE(Compare_Same); // Now recreate it and run another backup, check that we haven't got @@ -1425,6 +1425,7 @@ bool test_backup_disappearing_directory() "testfiles/TestDir1", // locationPath, "/whee", // remotePath fakeLocation); + clientContext.CloseAnyOpenConnection(); TEST_COMPARE(Compare_Same); TEARDOWN(); @@ -1957,11 +1958,20 @@ bool test_bbackupd_exclusions() // housekeeping the next time it runs. We hold onto the client // context (and hence an open connection) to stop it from // running for now. + + // But we can't do that on Windows, because bbstored only + // support one simultaneous connection. So we have to hope that + // housekeeping has run recently enough that it doesn't need to + // run again when we disconnect. BOX_INFO("Finding out whether bbackupd marked files as deleted"); // TODO FIXME dedent { +#ifdef WIN32 + apClientContext.reset(); +#endif + std::auto_ptr<BackupProtocolCallable> client = connect_and_login(context, BackupProtocolLogin::Flags_ReadOnly); |