refactor(general): minor cleanups (#4621)

- add assertion messages to help troubleshooting upload tests.
- fix typo
- fix debug log message
This commit is contained in:
Julio Lopez
2025-05-30 23:06:53 -07:00
committed by GitHub
parent 3f01b0c578
commit d5f23be119
2 changed files with 10 additions and 5 deletions

View File

@@ -52,7 +52,7 @@
const (
parallelFetches = 5 // number of parallel reads goroutines
flushPackIndexTimeout = 10 * time.Minute // time after which all pending indexes are flushes
flushPackIndexTimeout = 10 * time.Minute // time after which all pending indexes are flushed
defaultMinPreambleLength = 32
defaultMaxPreambleLength = 32
defaultPaddingUnit = 4096
@@ -858,7 +858,7 @@ func (bm *WriteManager) GetContent(ctx context.Context, contentID ID) (v []byte,
_, err = bm.getContentDataAndInfo(ctx, contentID, &tmp)
if err != nil {
bm.log.Debugf("getContentInfoReadLocked(%v) error %v", contentID, err)
bm.log.Debugf("getContentDataAndInfo(%v) error %v", contentID, err)
return nil, err
}

View File

@@ -1259,11 +1259,16 @@ func TestParallelUploadOfLargeFiles(t *testing.T) {
fs.IterateEntries(ctx, dir, func(ctx context.Context, e fs.Entry) error {
if f, ok := e.(fs.File); ok {
oid, err := object.ParseID(strings.TrimPrefix(f.(object.HasObjectID).ObjectID().String(), "I"))
require.NoError(t, err)
hoid, hasObjectId := f.(object.HasObjectID)
require.True(t, hasObjectId)
oids := hoid.ObjectID().String()
oid, err := object.ParseID(strings.TrimPrefix(oids, "I"))
require.NoError(t, err, "failed to parse object id", oids)
entries, err := object.LoadIndexObject(ctx, th.repo.(repo.DirectRepositoryWriter).ContentManager(), oid)
require.NoError(t, err)
require.NoError(t, err, "failed to parse indirect object id", oid)
// ensure that index object contains breakpoints at all multiples of 'chunkSize'.
// Because we picked unusual chunkSize, this proves that uploads happened individually