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

Function TestConfigure_PkgCacheWritable

cmds/cmd_configure_test.go:540–565  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

538}
539
540func 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
567func TestConfigure_PkgCacheDir_DirNotExist(t *testing.T) {
568 celer := newInitializedCeler(t)

Callers

nothing calls this directly

Calls 8

CommandMethod · 0.95
InitMethod · 0.95
PkgCacheConfigMethod · 0.95
NewCelerFunction · 0.92
newInitializedCelerFunction · 0.85
runCommandFunction · 0.85
MkdirAllMethod · 0.80
IsWritableMethod · 0.65

Tested by

no test coverage detected