Skip to content

Commit

Permalink
increase coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <[email protected]>
  • Loading branch information
wangxiaoxuan273 committed Jan 9, 2024
1 parent 39cbce3 commit 9a2b4c6
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions content/oci/oci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3016,21 +3016,13 @@ func TestStore_GCErrorPath(t *testing.T) {
t.Error("failed to push test content to src")
}

// test os.ReadDir() errors
// s.root = "random dir"
// if err = s.GC(ctx); err == nil {
// t.Fatal("expect an error when os.ReadDir()")
// }
// s.root = tempDir
// if err := os.WriteFile(path.Join(algPath, "sha384"), []byte("not a dir"), 0444); err != nil {
// t.Fatal("error calling WriteFile(), error =", err)
// }
// if err = s.GC(ctx); err != nil {
// t.Fatal("this error should be silently ignored")
// }
// if err := os.Remove(path.Join(algPath, "sha384")); err != nil {
// t.Fatal(err)
// }
// test os.ReadDir() error
if err := os.Mkdir(path.Join(algPath, "sha666"), 0777); err != nil {
t.Fatal(err)
}
if err = s.GC(ctx); err != nil {
t.Fatal("this error should be silently ignored")
}

// test os.Remove() error
badDigest := digest.FromBytes([]byte("bad digest")).Encoded()
Expand Down

0 comments on commit 9a2b4c6

Please sign in to comment.