MCPcopy
hub / github.com/kserve/kserve / TestCreate

Function TestCreate

pkg/agent/storage/utils_test.go:31–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29)
30
31func TestCreate(t *testing.T) {
32 g := gomega.NewGomegaWithT(t)
33
34 // This would get called in StartPullerAndProcessModels
35 syscall.Umask(0)
36
37 tmpDir := t.TempDir()
38 folderPath := path.Join(tmpDir, "foo")
39 filePath := path.Join(folderPath, "bar.txt")
40 f, err := Create(filePath)
41 if err != nil {
42 t.Fatalf("Unable to create file: %v", err)
43 }
44 defer func() { _ = f.Close() }()
45
46 g.Expect(err).ToNot(gomega.HaveOccurred())
47 g.Expect(folderPath).To(gomega.BeADirectory())
48
49 info, _ := os.Stat(folderPath)
50 mode := info.Mode()
51 expectedMode := os.ModePerm
52 g.Expect(mode.Perm()).To(gomega.Equal(expectedMode))
53}
54
55func TestFileExists(t *testing.T) {
56 g := gomega.NewGomegaWithT(t)

Callers

nothing calls this directly

Calls 2

CloseMethod · 0.80
CreateFunction · 0.70

Tested by

no test coverage detected