Repository: kopia/kopia
Pull request #4621 (2025-05-31 05:13:01)

refactor(general): minor cleanups
- add assertion messages to help troubleshooting upload tests.
- fix typo
- fix debug log message

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/kopia/kopia/pull/4621?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 76.41%. Comparing base [(`cb455c6`)](https://app.codecov.io/gh/kopia/kopia/commit/cb455c699a04e54cb47e25a676d7d65063ce883e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) to head [(`d396f44`)](https://app.codecov.io/gh/kopia/kopia/commit/d396f445e5a8203c34d301d7ae164f0d95839a0d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).
> Report is 538 commits behind head on master.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #4621      +/-   ##
==========================================
+ Coverage   75.86%   76.41%   +0.55%     
==========================================
  Files         470      529      +59     
  Lines       37301    40162    +2861     
==========================================
+ Hits        28299    30691    +2392     
- Misses       7071     7452     +381     
- Partials     1931     2019      +88     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/kopia/kopia/pull/4621?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>

Patch:
diff --git a/repo/content/content_manager.go b/repo/content/content_manager.go
index 54c45926..06bd4163 100644
--- a/repo/content/content_manager.go
+++ b/repo/content/content_manager.go
@@ -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
 	}
 


Test patch:
diff --git a/snapshot/upload/upload_test.go b/snapshot/upload/upload_test.go
index af11c011..fc8398b9 100644
--- a/snapshot/upload/upload_test.go
+++ b/snapshot/upload/upload_test.go
@@ -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