MCPcopy
hub / github.com/perkeep/perkeep / TestStaticFIFO

Function TestStaticFIFO

pkg/schema/schema_test.go:601–632  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

599}
600
601func TestStaticFIFO(t *testing.T) {
602 tdir := t.TempDir()
603
604 fifoPath := filepath.Join(tdir, "fifo")
605 err := osutil.Mkfifo(fifoPath, 0660)
606 if err == osutil.ErrNotSupported {
607 t.SkipNow()
608 }
609 if err != nil {
610 t.Fatalf("osutil.Mkfifo(): %v", err)
611 }
612
613 fi, err := os.Lstat(fifoPath)
614 if err != nil {
615 t.Fatalf("os.Lstat(): %v", err)
616 }
617
618 bb := NewCommonFileMap(fifoPath, fi)
619 bb.SetType(TypeFIFO)
620 bb.SetFileName(fifoPath)
621 blob := bb.Blob()
622 t.Logf("Got JSON for fifo: %s\n", blob.JSON())
623
624 sf, ok := blob.AsStaticFile()
625 if !ok {
626 t.Fatalf("Blob.AsStaticFile(): Expected true, got false")
627 }
628 _, ok = sf.AsStaticFIFO()
629 if !ok {
630 t.Fatalf("StaticFile.AsStaticFIFO(): Expected true, got false")
631 }
632}
633
634func TestStaticSocket(t *testing.T) {
635 tdir := t.TempDir()

Callers

nothing calls this directly

Calls 11

MkfifoFunction · 0.92
NewCommonFileMapFunction · 0.85
SetTypeMethod · 0.80
SetFileNameMethod · 0.80
LogfMethod · 0.80
AsStaticFileMethod · 0.80
AsStaticFIFOMethod · 0.80
FatalfMethod · 0.65
LstatMethod · 0.65
BlobMethod · 0.65
JSONMethod · 0.45

Tested by

no test coverage detected