-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadonly_test.go
More file actions
112 lines (81 loc) · 2.34 KB
/
Copy pathreadonly_test.go
File metadata and controls
112 lines (81 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package aferox_test
import (
"os"
"syscall"
"time"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/unmango/aferox"
)
var _ = Describe("Readonly", func() {
Describe("ReadonlyFs", func() {
var fs *aferox.ReadOnlyFs
BeforeEach(func() {
fs = &aferox.ReadOnlyFs{}
})
It("should error on Create", func() {
_, err := fs.Create("")
Expect(err).To(MatchError(syscall.EPERM))
})
It("should error on Chmod", func() {
Expect(fs.Chmod("", 0)).To(MatchError(syscall.EPERM))
})
It("should error on Chown", func() {
Expect(fs.Chown("", 0, 0)).To(MatchError(syscall.EPERM))
})
It("should error on Chtimes", func() {
Expect(fs.Chtimes("", time.Now(), time.Now())).To(MatchError(syscall.EPERM))
})
It("should error on Mkdir", func() {
Expect(fs.Mkdir("", os.ModePerm)).To(MatchError(syscall.EPERM))
})
It("should error on MkdirAll", func() {
Expect(fs.MkdirAll("", os.ModePerm)).To(MatchError(syscall.EPERM))
})
It("should error on Remove", func() {
Expect(fs.Remove("")).To(MatchError(syscall.EPERM))
})
It("should error on RemoveAll", func() {
Expect(fs.RemoveAll("")).To(MatchError(syscall.EPERM))
})
It("should error on Rename", func() {
Expect(fs.Rename("", "")).To(MatchError(syscall.EPERM))
})
})
Describe("ReadonlyFile", func() {
var file *aferox.ReadOnlyFile
BeforeEach(func() {
file = &aferox.ReadOnlyFile{}
})
It("should error on readdir", func() {
_, err := file.Readdir(0)
Expect(err).To(MatchError(syscall.EPERM))
})
It("should error on readdir names", func() {
_, err := file.Readdirnames(0)
Expect(err).To(MatchError(syscall.EPERM))
})
It("should error on seek", func() {
_, err := file.Seek(0, 0)
Expect(err).To(MatchError(syscall.EPERM))
})
It("should error on sync", func() {
Expect(file.Sync()).To(MatchError(syscall.EPERM))
})
It("should error on truncate", func() {
Expect(file.Truncate(0)).To(MatchError(syscall.EPERM))
})
It("should error on write", func() {
_, err := file.Write(nil)
Expect(err).To(MatchError(syscall.EPERM))
})
It("should error on write at", func() {
_, err := file.WriteAt(nil, 0)
Expect(err).To(MatchError(syscall.EPERM))
})
It("should error on write string", func() {
_, err := file.WriteString("")
Expect(err).To(MatchError(syscall.EPERM))
})
})
})