MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestCCache_Setup_MkdirFails

Function TestCCache_Setup_MkdirFails

configs/ccache_test.go:92–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestCCache_Setup_MkdirFails(t *testing.T) {
93 // Use a path that cannot be created: parent is a file, not a directory.
94 dir := t.TempDir()
95 badDir := filepath.Join(dir, "file")
96 if err := os.WriteFile(badDir, []byte("x"), 0644); err != nil {
97 t.Fatalf("setup: %v", err)
98 }
99 impossibleDir := filepath.Join(badDir, "subdir")
100
101 ccache := &CCache{Enabled: true, Dir: impossibleDir, MaxSize: "1G"}
102 if err := ccache.Setup(); err == nil {
103 t.Error("Setup() should fail when mkdir fails")
104 }
105}
106
107func TestCCache_Generate(t *testing.T) {
108 var builder strings.Builder

Callers

nothing calls this directly

Calls 3

SetupMethod · 0.95
WriteFileMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected