Fix regexp for error put object with lock mode
Signed-off-by: Yulia Kovshova <y.kovshova@yadro.com>
This commit is contained in:
parent
0aeb998be9
commit
ce41104d3a
1 changed files with 17 additions and 3 deletions
|
@ -851,14 +851,28 @@ class TestS3GateObject(TestS3GateBase):
|
||||||
with allure.step("Put object with lock-mode"):
|
with allure.step("Put object with lock-mode"):
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
Exception,
|
Exception,
|
||||||
match=r".*fetch time to epoch: time '0001-01-01T00:00:00Z' must be in the future.*",
|
match=r".*must both be supplied*",
|
||||||
):
|
):
|
||||||
# An error occurred (InternalError) when calling the PutObject operation (reached max retries: 2):
|
# x-amz-object-lock-retain-until-date and x-amz-object-lock-mode must both be supplied
|
||||||
# fetch time to epoch: time '0001-01-01T00:00:00Z' must be in the future (after 2022-09-15T08:59:30Z)
|
|
||||||
s3_gate_object.put_object_s3(
|
s3_gate_object.put_object_s3(
|
||||||
self.s3_client, bucket, file_path_1, ObjectLockMode="COMPLIANCE"
|
self.s3_client, bucket, file_path_1, ObjectLockMode="COMPLIANCE"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
with allure.step("Put object with lock-mode and past date"):
|
||||||
|
date_obj = datetime.utcnow() - timedelta(days=3)
|
||||||
|
with pytest.raises(
|
||||||
|
Exception,
|
||||||
|
match=r".*until date must be in the future*",
|
||||||
|
):
|
||||||
|
# The retain until date must be in the future
|
||||||
|
s3_gate_object.put_object_s3(
|
||||||
|
self.s3_client,
|
||||||
|
bucket,
|
||||||
|
file_path_1,
|
||||||
|
ObjectLockMode="COMPLIANCE",
|
||||||
|
ObjectLockRetainUntilDate=date_obj,
|
||||||
|
)
|
||||||
|
|
||||||
@allure.title("Test S3 Sync directory")
|
@allure.title("Test S3 Sync directory")
|
||||||
@pytest.mark.parametrize("sync_type", ["sync", "cp"])
|
@pytest.mark.parametrize("sync_type", ["sync", "cp"])
|
||||||
def test_s3_sync_dir(self, sync_type):
|
def test_s3_sync_dir(self, sync_type):
|
||||||
|
|
Loading…
Reference in a new issue