Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Patching tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pimotte committed Aug 13, 2014
1 parent 46a2a68 commit aa856b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
Expand Up @@ -112,6 +112,9 @@ public UpOperationResult execute() throws Exception {
logger.log(Level.INFO, "Running 'Sync up' at client " + config.getMachineName() + " ...");
logger.log(Level.INFO, "--------------------------------------------");

// TODO [medium/high] Remove this and construct mechanism to resume uploads
transferManager.cleanTransactions(config.getMachineName());

if (!checkPreconditions()) {
return result;
}
Expand Down
Expand Up @@ -365,17 +365,12 @@ public void testCleanupAfterFailedUpOperation() throws Exception {
// List of failing operations (regex)
// Format: abs=<count> rel=<count> op=<connect|init|upload|...> <operation description>

"rel=[345].+upload.+multichunk" // << 3 retries!
"rel=[456].+upload.+multichunk" // << 3 retries!
}));

TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);

CleanupOperationOptions removeOldCleanupOperationOptions = new CleanupOperationOptions();
removeOldCleanupOperationOptions.setMergeRemoteFiles(false);
removeOldCleanupOperationOptions.setRemoveOldVersions(true);
removeOldCleanupOperationOptions.setKeepVersionsCount(2);

StatusOperationOptions forceChecksumStatusOperationOptions = new StatusOperationOptions();
forceChecksumStatusOperationOptions.setForceChecksum(true);

Expand All @@ -400,7 +395,8 @@ public void testCleanupAfterFailedUpOperation() throws Exception {
File repoActionsDir = new File(testConnection.getRepositoryPath() + "/actions");

assertTrue(operationFailed);
assertEquals(1, repoMultiChunkDir.listFiles().length);
// Atomic operation, so multichunk is not yet present at location
assertEquals(0, repoMultiChunkDir.listFiles().length);
assertEquals(1, repoActionsDir.listFiles().length);

// 2. Call A.cleanup(); this does not run, because there are local changes
Expand All @@ -417,18 +413,17 @@ public void testCleanupAfterFailedUpOperation() throws Exception {

// 5. Call 'up' again, this uploads previously crashed stuff, and then runs cleanup.
// The cleanup then removes the old multichunk and the old action files.
File oldMultiChunkFile = repoMultiChunkDir.listFiles()[0];


UpOperationResult secondUpResult = clientA.up();
assertEquals(UpResultCode.OK_CHANGES_UPLOADED, secondUpResult.getResultCode());
assertEquals(3, repoMultiChunkDir.listFiles().length);
assertEquals(2, repoMultiChunkDir.listFiles().length);
assertEquals(0, repoActionsDir.listFiles().length);

// 6. Call 'cleanup' manually
// 6. Call 'cleanup' manually (Nothing happens, since transaction was cleaned on second up)
CleanupOperationResult cleanupOperationResult = clientA.cleanup();
assertEquals(CleanupOperationResult.CleanupResultCode.OK, cleanupOperationResult.getResultCode());
assertEquals(1, cleanupOperationResult.getRemovedMultiChunks().size());
assertFalse(oldMultiChunkFile.exists());
assertEquals(CleanupOperationResult.CleanupResultCode.OK_NOTHING_DONE, cleanupOperationResult.getResultCode());
assertEquals(0, cleanupOperationResult.getRemovedMultiChunks().size());
assertEquals(0, repoActionsDir.listFiles().length);

// Tear down
Expand Down
Expand Up @@ -44,7 +44,7 @@ public void testUnreliableUpload() throws Exception {
// Format: abs=<count> rel=<count> op=<connect|init|upload|...> <operation description>

// 1st upload (= multichunk) fails
"rel=[456] .+upload.+multichunk", // << 3 retries!!
"rel=[345] .+upload.+multichunk", // << 3 retries!!

// Make fourth upload fail
"rel=(8|9|10) .+upload" // << 3 retries!!
Expand Down

0 comments on commit aa856b4

Please sign in to comment.