Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions s3tests_boto3/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,7 @@ def test_object_write_read_update_read_delete():

# Write
client.put_object(Bucket=bucket_name, Key="foo", Body="bar")
time.sleep(1)
# Read
response = client.get_object(Bucket=bucket_name, Key="foo")
body = _get_body(response)
Expand Down Expand Up @@ -2303,7 +2304,8 @@ def test_object_metadata_replaced_on_put():
client = get_client()
metadata_dict = {"meta1": "bar"}
client.put_object(Bucket=bucket_name, Key="foo", Body="bar", Metadata=metadata_dict)

time.sleep(1)

client.put_object(Bucket=bucket_name, Key="foo", Body="bar")

response = client.get_object(Bucket=bucket_name, Key="foo")
Expand Down Expand Up @@ -8706,6 +8708,7 @@ def _test_atomic_read(file_size):

fp_a = FakeWriteFile(file_size, "A")
client.put_object(Bucket=bucket_name, Key="testobj", Body=fp_a)
time.sleep(1)

fp_b = FakeWriteFile(file_size, "B")
fp_a2 = FakeReadFile(
Expand Down Expand Up @@ -8750,6 +8753,7 @@ def _test_atomic_write(file_size):
# create <file_size> file of A's
fp_a = FakeWriteFile(file_size, "A")
client.put_object(Bucket=bucket_name, Key=objname, Body=fp_a)
time.sleep(1)

# verify A's
_verify_atomic_key_data(bucket_name, objname, file_size, "A")
Expand All @@ -8763,6 +8767,7 @@ def _test_atomic_write(file_size):
)

client.put_object(Bucket=bucket_name, Key=objname, Body=fp_b)
time.sleep(1)

# verify B's
_verify_atomic_key_data(bucket_name, objname, file_size, "B")
Expand Down Expand Up @@ -8805,15 +8810,15 @@ def rewind_put_fp_a():
# verify the file
_verify_atomic_key_data(bucket_name, objname, file_size, "B")


@pytest.mark.fails_on_dbstore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the test expectations here? Why is it expecting any particular order?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about test expectations, but I see the tests write in parallel the object with the same name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@roman-khimov roman-khimov Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the test is a flawed, but can be fixed. It says

confirm that it is all one or the other

But this means that any of the results (A or B) is correct. And the way it works is uploading objects ~concurrently, so we can't rely on B always being the last one. So to me that's the way to fix this test, not by disabling it (I admit it's a bit strange one, but the idea is to never get an AB mix which can theoretically happen).

Copy link

@evgeniiz321 evgeniiz321 Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test initiates one object upload, during this upload it starts and finishes another upload of the same object and after that the test finishes the first upload. Test expectation is that the object will have the contents of the first upload, because it finishes later.
But the test relies on the implementation of the boto3 put_object and I'm not really sure if the first upload really finishes later. But, if the test worked previously, maybe it was a correct assumption. Otherwise it would be a big flipper.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we expect rewind_put_fp_a() to finish first we can also add a delay into it.

def test_atomic_dual_write_1mb():
_test_atomic_dual_write(1024 * 1024)


@pytest.mark.fails_on_dbstore
def test_atomic_dual_write_4mb():
_test_atomic_dual_write(1024 * 1024 * 4)


@pytest.mark.fails_on_dbstore
def test_atomic_dual_write_8mb():
_test_atomic_dual_write(1024 * 1024 * 8)

Expand Down Expand Up @@ -9322,6 +9327,7 @@ def test_versioning_obj_plain_null_version_overwrite():
key = "testobjfoo"
content = "fooz"
client.put_object(Bucket=bucket_name, Key=key, Body=content)
time.sleep(1)

check_configure_versioning_retry(bucket_name, "Enabled", "Enabled")

Expand Down Expand Up @@ -9356,7 +9362,7 @@ def test_versioning_obj_plain_null_version_overwrite_suspended():
key = "testobjbar"
content = "foooz"
client.put_object(Bucket=bucket_name, Key=key, Body=content)

time.sleep(1)
check_configure_versioning_retry(bucket_name, "Enabled", "Enabled")
check_configure_versioning_retry(bucket_name, "Suspended", "Suspended")

Expand Down
2 changes: 2 additions & 0 deletions s3tests_boto3/functional/test_s3_neofs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,12 +1014,14 @@ def test_object_tagging_workflow():

response = client.put_object(Bucket=bucket_name, Key=object_name, Body="content")
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
time.sleep(1)

tags = {"TagSet": [{"Key": "object-tag-key", "Value": "object-tag-value"}]}
response = client.put_object_tagging(
Bucket=bucket_name, Key=object_name, Tagging=tags
)
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
time.sleep(1)

response = client.get_object_tagging(Bucket=bucket_name, Key=object_name)
assert len(response["TagSet"]) == 1
Expand Down