s3-pit-restore icon indicating copy to clipboard operation
s3-pit-restore copied to clipboard

Avoid duplicate with testcase

Open vikas-nautiyal opened this issue 3 years ago • 7 comments

This is the addition to the PR - #10 Added test case over the existing commit.

vikas-nautiyal avatar Jan 04 '22 06:01 vikas-nautiyal

I just ran a test of this an it worked as expected. Here's the steps I followed:

  • Upload 9 files to my bucket with versioning enabled at 11:45
  • Wait one minute
  • Delete one file
  • Upload a 10th file
  • Run s3-pit-restore -b bucketname -B bucketname -t "11:46:00 14-02-2022 +0" --avoid-duplicates
  • Result: The deleted file is restored, the extra file is set to a delete marker. All other files are left as a single version. Only the changed files are output.

We are working with buckets holding 4 million objects and 6TB of data, so this feature is an absolute must for us. Thank you for working on it!

marxjohnson avatar Feb 14 '22 11:02 marxjohnson

@marxjohnson Could you also do a run of the software testing suite?

angeloc avatar Feb 14 '22 11:02 angeloc

I ran: py ./s3-pit-restore -b mj5982-pit -B mj5982-pit -P restore-path --test And I got:

======================================================================
FAIL: test_avoid_duplicates (__main__.TestS3PitRestore)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mj5982\src\s3-pit-restore\s3-pit-restore", line 257, in test_avoid_duplicates
    self.assertTrue(self.compare_versions(version_before, version_after))
AssertionError: False is not true

----------------------------------------------------------------------
Ran 3 tests in 273.167s

FAILED (failures=1)

So something might not be quite right there. @vikas-nautiyal Any thoughts on why it's failing?

marxjohnson avatar Feb 14 '22 12:02 marxjohnson

@marxjohnson could you do a test run with the testing suite?

angeloc avatar Nov 17 '22 09:11 angeloc

Hi @marxjohnson, added a fix to the code. It was failing because the -P option would restore the files in a different directory i.e dest_prefix. added fix to verify if the restore directory is different than the root of the bucket and act accordingly.

vikas-nautiyal avatar Nov 17 '22 09:11 vikas-nautiyal

@vikas-nautiyal could you rebase the MR, I'll have a run and merge if it's ok. Thanks!

angeloc avatar Apr 21 '23 08:04 angeloc

@vikas-nautiyal It would be nice if you could rebase this PR resolving conflicts so I can merge it. Thanks!

angeloc avatar Jan 17 '24 10:01 angeloc