| 30 | } |
| 31 | |
| 32 | func TestCCache_Setup_Disabled(t *testing.T) { |
| 33 | disable, _ := os.LookupEnv("CCACHE_DISABLE") |
| 34 | defer func() { |
| 35 | if disable != "" { |
| 36 | os.Setenv("CCACHE_DISABLE", disable) |
| 37 | } else { |
| 38 | os.Unsetenv("CCACHE_DISABLE") |
| 39 | } |
| 40 | }() |
| 41 | |
| 42 | dir := t.TempDir() |
| 43 | ccache := &CCache{Enabled: false, Dir: dir} |
| 44 | |
| 45 | if err := ccache.Setup(); err != nil { |
| 46 | t.Fatalf("Setup() error = %v", err) |
| 47 | } |
| 48 | |
| 49 | if v := os.Getenv("CCACHE_DISABLE"); v != "1" { |
| 50 | t.Errorf("CCACHE_DISABLE = %q, want 1", v) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func TestCCache_Setup_RemoteStorage(t *testing.T) { |
| 55 | keys := []string{"CCACHE_REMOTE_STORAGE", "CCACHE_REMOTE_ONLY"} |