MCPcopy
hub / github.com/perkeep/perkeep / TestWriteError

Function TestWriteError

pkg/blobserver/diskpacked/diskpacked_test.go:345–366  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

343}
344
345func TestWriteError(t *testing.T) {
346 if runtime.GOOS == "windows" {
347 t.Skip("skipping symlink test on Windows")
348 }
349 dir, err := os.MkdirTemp("", "diskpacked-test")
350 if err != nil {
351 t.Fatal(err)
352 }
353 if !env.IsDebug() {
354 defer os.RemoveAll(dir)
355 }
356 t.Logf("diskpacked test dir is %q", dir)
357 fn := filepath.Join(dir, "pack-00000.blobs")
358 if err := os.Symlink("/non existing file", fn); err != nil {
359 t.Fatal(err)
360 }
361 s, err := newStorage(dir, 1, jsonconfig.Obj{"type": "memory"})
362 if err == nil {
363 s.Close()
364 t.Fatal("expected error for non-existing directory")
365 }
366}

Callers

nothing calls this directly

Calls 6

IsDebugFunction · 0.92
newStorageFunction · 0.85
FatalMethod · 0.80
LogfMethod · 0.80
SymlinkMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected