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

Function TestFileCreation

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

Source from the content-addressed store, hash-verified

56}
57
58func TestFileCreation(t *testing.T) {
59 srw := newFakeResponse()
60 files, _ := os.ReadDir(testTmpWriterDir)
61 nbFileBefore := len(files)
62
63 tmpFileRespWriter, err := NewTmpFileResponseWriter(srw, testTmpWriterDir)
64 defer tmpFileRespWriter.Close()
65 if err != nil {
66 t.Fatalf("could not initate TmpFileResponseWriter error:%s", err)
67 return
68 }
69
70 files, _ = os.ReadDir(testTmpWriterDir)
71 nbFileAfter := len(files)
72 if nbFileAfter == nbFileBefore {
73 t.Fatalf("Error while creating tmp file")
74 return
75 }
76}
77
78func TestFileRemoval(t *testing.T) {
79 srw := newFakeResponse()

Callers

nothing calls this directly

Calls 3

CloseMethod · 0.95
newFakeResponseFunction · 0.85
NewTmpFileResponseWriterFunction · 0.85

Tested by

no test coverage detected