MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / TestFileRemoval

Function TestFileRemoval

cache/tmp_file_response_writer_test.go:78–96  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func TestFileRemoval(t *testing.T) {
79 srw := newFakeResponse()
80 files, _ := os.ReadDir(testTmpWriterDir)
81 nbFileBefore := len(files)
82
83 tmpFileRespWriter, err := NewTmpFileResponseWriter(srw, testTmpWriterDir)
84 if err != nil {
85 t.Fatalf("could not initate TmpFileResponseWriter error:%s", err)
86 return
87 }
88 tmpFileRespWriter.Close()
89
90 files, _ = os.ReadDir(testTmpWriterDir)
91 nbFileAfter := len(files)
92 if nbFileAfter != nbFileBefore {
93 t.Fatalf("Error while deleting tmp file")
94 return
95 }
96}
97
98func TestWriteThenReadHeader(t *testing.T) {
99 srw := newFakeResponse()

Callers

nothing calls this directly

Calls 3

CloseMethod · 0.95
newFakeResponseFunction · 0.85
NewTmpFileResponseWriterFunction · 0.85

Tested by

no test coverage detected