[Box Backup-commit] COMMIT r3501 - box/trunk/test/bbackupd

subversion at boxbackup.org subversion at boxbackup.org
Fri Dec 26 23:17:09 GMT 2014


Author: chris
Date: 2014-12-26 23:17:09 +0000 (Fri, 26 Dec 2014)
New Revision: 3501

Modified:
   box/trunk/test/bbackupd/testbbackupd.cpp
Log:
Fix test failures caused by connections left open on Windows.

Modified: box/trunk/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/trunk/test/bbackupd/testbbackupd.cpp	2014-12-26 23:17:05 UTC (rev 3500)
+++ box/trunk/test/bbackupd/testbbackupd.cpp	2014-12-26 23:17:09 UTC (rev 3501)
@@ -1376,8 +1376,6 @@
 		&bbackupd);
 	params.mSyncPeriodEnd = GetCurrentBoxTime();
 
-	BackupProtocolCallable& connection = clientContext.GetConnection();
-
 	BackupClientFileAttributes attr;
 	attr.ReadAttributes("testfiles/TestDir1",
 		false /* put mod times in the attributes, please */);
@@ -1384,11 +1382,12 @@
 	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 @@
 		"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 @@
 		"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 @@
 		"testfiles/TestDir1", // locationPath,
 		"/whee", // remotePath
 		fakeLocation);
+	clientContext.CloseAnyOpenConnection();
 	TEST_COMPARE(Compare_Same);
 
 	TEARDOWN();
@@ -1957,11 +1958,20 @@
 		// 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);




More information about the Boxbackup-commit mailing list