Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add mutation test case #598

Merged
merged 2 commits into from
Feb 27, 2024
Merged

test: add mutation test case #598

merged 2 commits into from
Feb 27, 2024

Conversation

cojenco
Copy link
Contributor

@cojenco cojenco commented Feb 24, 2024

Context: mutation test caught missing test case in internal cl/609739391

Not sure why productive coverage check is angry as there is test coverage through

def test_bidi_write_object_resumable(self):
start = self.grpc.StartResumableWrite(
storage_pb2.StartResumableWriteRequest(
write_object_spec=storage_pb2.WriteObjectSpec(
resource=storage_pb2.Object(
name="object-name", bucket="projects/_/buckets/bucket-name"
)
)
),
context=unittest.mock.MagicMock(),
)
self.assertIsNotNone(start.upload_id)
QUANTUM = 256 * 1024
media = TestGrpc._create_block(2 * QUANTUM + QUANTUM / 2).encode("utf-8")
offset = 0
content = media[0:QUANTUM]
r1 = storage_pb2.BidiWriteObjectRequest(
upload_id=start.upload_id,
write_offset=offset,
checksummed_data=storage_pb2.ChecksummedData(
content=content, crc32c=crc32c.crc32c(content)
),
flush=True,
finish_write=False,
)
offset = QUANTUM
content = media[QUANTUM : 2 * QUANTUM]
r2 = storage_pb2.BidiWriteObjectRequest(
upload_id=start.upload_id,
write_offset=offset,
checksummed_data=storage_pb2.ChecksummedData(
content=content, crc32c=crc32c.crc32c(content)
),
flush=True,
state_lookup=True,
finish_write=False,
)
streamer = self.grpc.BidiWriteObject([r1, r2], "fake-context")

@cojenco cojenco requested review from coryan and a team as code owners February 24, 2024 00:57
Copy link

codecov bot commented Feb 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.68%. Comparing base (a60a714) to head (cd5d13b).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #598      +/-   ##
==========================================
+ Coverage   98.63%   98.68%   +0.05%     
==========================================
  Files          50       50              
  Lines        8365     8462      +97     
==========================================
+ Hits         8251     8351     +100     
+ Misses        114      111       -3     
Flag Coverage Δ
unittests 98.68% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

gcs/upload.py Outdated Show resolved Hide resolved
@cojenco cojenco merged commit 87437e1 into googleapis:main Feb 27, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants