Repository navigation
test(b2): strengthen live tests and add credential-free twins - #248
Merged
Merged
Conversation
david-santacruz-backblaze
suggested changes
Oct 30, 2026
david-santacruz-backblaze
left a comment
There was a problem hiding this comment.
Mate, all good. Two small asks:
TestNewBucketAttributesWire: also assert the decodedbucket.Attrs(ctx). The fixture has empty info and lifecycle rules, so the live round-trip has no twin.intent/b2-live-assertions/: drop it and move the proof table to the PR body, or addintent.mdandspec.md.
Contributor
Author
|
@david-santacruz-backblaze Thanks, both done:
|
david-santacruz-backblaze
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Part of the test-integrity audit (#97). This PR covers the
b2/integration_test.goitems of #204's### b2section (slice C2). Those are live tests: they only run with B2 credentials, in the live CI job onmain, so several of them asserted less than their names say and nothing checked them offline.Changes
Test-only.
Live tests strengthened (compile-checked locally; they run in the live job):
TestResumeWriterWithoutExtantFile,TestFileBufferLive: close the writer, read the object back and compare its SHA1 with the input.TestZeroByteObject,TestWriteEmpty: assertSize == 0and empty content on read-back.TestDeleteWithoutName: a fresh handle'sAttrsmust return not-exist after delete.TestListUnfinishedLargeFiles: asserts the exact names, the count andErr(); the chunk size is raised to B2's 5 MB part minimum.TestCopyLive: compares the copy's SHA1 with the source's, not the destination's own.TestReauthPreservesOptions,TestNewBucket,TestBucketDefaultEncryption: assert behavior instead of an internal struct, and no longer depend on the account's default encryption.Credential-free twins (new
*_wire_test.go, usinginternal/b2wiretest):TestZeroByteObjectWire,TestDeleteWithoutNameWireTestReauthPreservesOptionsWire: user agents, all three test modes, the transport, the endpoint and the refreshed token survive reauthorization, checked on real HTTP requests.TestNewBucketAttributesWire,TestNewBucketDefaultEncryptionWire: create fields, omitted versus explicit SSE (perb2_create_bucket), and decoding of the service's answer.Verification
Each break was applied alone to production code; the twin failed, then passed after revert. The live tests are compile-checked only (they run with B2 credentials in the live job on
main).TestResumeWriterWithoutExtantFileTestZeroByteObject;TestZeroByteObjectWireTestDeleteWithoutName;TestWriteEmpty;TestDeleteWithoutNameWire;TestZeroByteObjectWireTestListUnfinishedLargeFilesTestFileBufferLiveTestCopyLiveTestReauthPreservesOptions;TestReauthPreservesOptionsWireTestNewBucket;TestBucketDefaultEncryption;TestNewBucketAttributesWire;TestNewBucketDefaultEncryptionWireTestZeroByteObjectWire;b2/b2.go:attrsFromFileInfoSizetosize + 1empty object size = 1, want 0(both chunk-size cases); test failedTestDeleteWithoutNameWire;b2/b2.go:Object.DeletedeleteFileVersionAttrs after Delete = <nil>, want not-exist;delete calls = 0, want 1; test failedTestReauthPreservesOptionsWire;b2/backend.go:beRoot.reauthorizeAccountuserAgentsin the options passed to reauthorizationUser-Agent = "blazer/0.9.0", want both custom agents before blazer/; test failedTestReauthPreservesOptionsWire;b2/backend.go:beRoot.reauthorizeAccounttransportin the options passed to reauthorizationconfigured transport calls = 2, want 4; test failedTestNewBucketAttributesWire;b2/b2.go:Client.NewBucketcreateBucketb2_create_bucket body lifecycleRules: got nullinstead of the two literal rules; test failedTestNewBucketDefaultEncryptionWire;base/base.go:B2.CreateBucketdefaultServerSideEncryption: got {"algorithm":"AES256","mode":"SSE-B2"}, want missing(both omitted cases); test failedTestNewBucketDefaultEncryptionWire;b2/baseline.go:b2Bucket.attrsbrokendefault encryption = &{Mode:broken Algorithm:AES256}, want &{Mode:SSE-B2 Algorithm:AES256}; test failedTestReauthPreservesOptionsWire;b2/baseline.go:authOptionscapExceededblock that addsbase.ForceCapExceeded()force_cap_exceeded; test failedAdded for review:
TestNewBucketAttributesWirealso asserts the decodedbucket.Attrs(ctx)(bucket info and each lifecycle-rule field) from literal B2-shaped create and list responses. Dropping lifecycle-rule decoding fails it withAttrs LifecycleRules = 0 rules, want 2.make ci(tail)Part of #204