@Test
public void testFailedRetriesUpload() throws Exception {

    try {
        Collection<File> files = generateFiles(1, 1, 1);
        for (File file : files) {
            failureFileSystem.uploadFile(
                    file.toPath(), file.toPath(), getDummyPath(file.toPath()), 2, true);
        }
    } catch (BackupRestoreException e) {
        // Verify the failure metric for upload is incremented.
        Assert.assertEquals(1, (int) backupMetrics.getInvalidUploads().count());
    }
}