Skip to content

Find, verify, and analyze leaked credentials

treat missing directory as fatal error in TestChunkUnit (#4263)

Shahzad Haiderd7e0ebb11e15
diff --git a/pkg/sources/git/git_test.go b/pkg/sources/git/git_test.go
index e4273c32b..94ca84c8f 100644
--- a/pkg/sources/git/git_test.go
+++ b/pkg/sources/git/git_test.go
@@ -587,13 +587,14 @@ func TestChunkUnit(t *testing.T) {
}, &reporter)
assert.NoError(t, err)
- // Error path.
+ // Error path - should return fatal error for missing directory.
err = s.ChunkUnit(ctx, SourceUnit{
ID: "/file/not/found",
Kind: UnitDir,
}, &reporter)
- assert.NoError(t, err)
+ assert.Error(t, err)
+ assert.Contains(t, err.Error(), "directory does not exist")
assert.Equal(t, 22, len(reporter.Chunks))
- assert.Equal(t, 1, len(reporter.ChunkErrs))
+ assert.Equal(t, 0, len(reporter.ChunkErrs))
}