(t *testing.T)
| 538 | } |
| 539 | |
| 540 | func TestConfigure_PkgCacheWritable(t *testing.T) { |
| 541 | celer := newInitializedCeler(t) |
| 542 | cmd := &configureCmd{} |
| 543 | |
| 544 | // Must create cache dir before setting cache dir. |
| 545 | if err := os.MkdirAll(dirs.TestPkgCacheDir, os.ModePerm); err != nil { |
| 546 | t.Fatal(err) |
| 547 | } |
| 548 | |
| 549 | // pkgcache-dir and pkgcache-writable are in the same group, so we can set |
| 550 | // them together in a single command just like a user would. |
| 551 | if _, err := runCommand(t, cmd.Command(celer), |
| 552 | "--pkgcache-dir="+dirs.TestPkgCacheDir, |
| 553 | "--pkgcache-writable=true", |
| 554 | ); err != nil { |
| 555 | t.Fatal(err) |
| 556 | } |
| 557 | |
| 558 | celer2 := configs.NewCeler() |
| 559 | if err := celer2.Init(); err != nil { |
| 560 | t.Fatal(err) |
| 561 | } |
| 562 | if !celer2.PkgCacheConfig().IsWritable() { |
| 563 | t.Fatal("cache writable should be `true`") |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | func TestConfigure_PkgCacheDir_DirNotExist(t *testing.T) { |
| 568 | celer := newInitializedCeler(t) |
nothing calls this directly
no test coverage detected