satellite/accounting/tally: make test less fragile

MetadataSize can slightly vary and checking for exact value makes
difficult to change what's being encoded in metadata.

Change-Id: I5f1ade41bc26d115e6743367ee35cf1ba74795c9
This commit is contained in:
Egon Elbre 2020-11-25 13:33:24 +02:00
parent c6626748d0
commit 3792e2921c

View File

@ -89,7 +89,7 @@ func TestOnlyInline(t *testing.T) {
ObjectCount: 1,
InlineSegments: 1,
InlineBytes: int64(expectedTotalBytes),
MetadataSize: 113, // brittle, this is hardcoded since its too difficult to get this value progamatically
MetadataSize: 0,
}
// Execute test: upload a file, then calculate at rest data
@ -108,6 +108,9 @@ func TestOnlyInline(t *testing.T) {
assert.Equal(t, 1, len(obs.Bucket))
for _, actualTally := range obs.Bucket {
// checking the exact metadata size is brittle, instead, verify that it's not zero
assert.NotZero(t, actualTally.MetadataSize)
actualTally.MetadataSize = expectedTally.MetadataSize
assert.Equal(t, expectedTally, actualTally)
}
}