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

Function TestCCache_Setup_Enabled

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

Source from the content-addressed store, hash-verified

8)
9
10func TestCCache_Setup_Enabled(t *testing.T) {
11 disable, _ := os.LookupEnv("CCACHE_DISABLE")
12 defer func() {
13 if disable != "" {
14 os.Setenv("CCACHE_DISABLE", disable)
15 } else {
16 os.Unsetenv("CCACHE_DISABLE")
17 }
18 }()
19
20 dir := t.TempDir()
21 ccache := &CCache{Enabled: true, Dir: dir}
22
23 if err := ccache.Setup(); err != nil {
24 t.Fatalf("Setup() error = %v", err)
25 }
26
27 if v := os.Getenv("CCACHE_DISABLE"); v == "1" {
28 t.Errorf("CCACHE_DISABLE = %q, want 0", v)
29 }
30}
31
32func TestCCache_Setup_Disabled(t *testing.T) {
33 disable, _ := os.LookupEnv("CCACHE_DISABLE")

Callers

nothing calls this directly

Calls 1

SetupMethod · 0.95

Tested by

no test coverage detected