MCPcopy Index your code
hub / github.com/kopia/kopia / TestPathLockWithoutBlock

Function TestPathLockWithoutBlock

tests/robustness/pathlock/path_lock_test.go:148–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

146}
147
148func TestPathLockWithoutBlock(t *testing.T) {
149 pl := NewLocker()
150
151 cwd, err := os.Getwd()
152 if err != nil {
153 t.Fatalf("Could not get working directory: %v", err)
154 }
155
156 for ti, tc := range []struct {
157 name string
158 path1 string
159 path2 string
160 }{
161 {
162 name: "(Abs) Allows a Lock call for path /a/b/x",
163 path1: "/a/b/c",
164 path2: "/a/b/x",
165 },
166 {
167 name: "(Abs) Allows a Lock call for path /a/x",
168 path1: "/a/b/c",
169 path2: "/a/x",
170 },
171 {
172 name: "(Rel) Allows a Lock call for path a/b/x",
173 path1: "a/b/c",
174 path2: "a/b/x",
175 },
176 {
177 name: "(Rel) Allows a Lock call for path a/x",
178 path1: "a/b/c",
179 path2: "a/x",
180 },
181 {
182 name: "(Mix Abs/Rel) Allows a Lock call for path a/b/x",
183 path1: filepath.Join(cwd, "a/b/c"),
184 path2: "a/b/x",
185 },
186 {
187 name: "(Mix Abs/Rel) Allows a Lock call for path a/x",
188 path1: filepath.Join(cwd, "a/b/c"),
189 path2: "a/x",
190 },
191 {
192 name: "(Mix Rel/Abs) Allows a Lock call for path a/b/x",
193 path1: "a/b/c",
194 path2: filepath.Join(cwd, "a/b/x"),
195 },
196 {
197 name: "(Mix Rel/Abs) Allows a Lock call for path a/x",
198 path1: "a/b/c",
199 path2: filepath.Join(cwd, "a/x"),
200 },
201 } {
202 t.Logf("%v %v (path1: %q, path2: %q)", ti, tc.name, tc.path1, tc.path2)
203
204 goroutineDoneWg := new(sync.WaitGroup)
205 goroutineDoneWg.Add(1)

Callers

nothing calls this directly

Calls 10

LockMethod · 0.95
NewLockerFunction · 0.85
FatalfMethod · 0.80
LogfMethod · 0.80
DoneMethod · 0.65
StoreMethod · 0.65
UnlockMethod · 0.65
WaitMethod · 0.65
LoadMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected