MCPcopy
hub / github.com/syncthing/syncthing / TestReadOnlyDir

Function TestReadOnlyDir

lib/model/sharedpullerstate_test.go:17–36  ·  view source on GitHub ↗

Test creating temporary file inside read-only directory

(t *testing.T)

Source from the content-addressed store, hash-verified

15
16// Test creating temporary file inside read-only directory
17func TestReadOnlyDir(t *testing.T) {
18 ffs := fs.NewFilesystem(fs.FilesystemTypeFake, rand.String(32))
19 ffs.Mkdir("testdir", 0o555)
20
21 s := sharedPullerState{
22 fs: ffs,
23 tempName: "testdir/.temp_name",
24 }
25
26 fd, err := s.tempFile()
27 if err != nil {
28 t.Fatal(err)
29 }
30 if fd == nil {
31 t.Fatal("Unexpected nil fd")
32 }
33
34 s.fail(nil)
35 s.finalClose()
36}

Callers

nothing calls this directly

Calls 7

MkdirMethod · 0.95
tempFileMethod · 0.95
failMethod · 0.95
finalCloseMethod · 0.95
NewFilesystemFunction · 0.92
StringFunction · 0.92
FatalMethod · 0.80

Tested by

no test coverage detected