Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 // that can be found in the LICENSE file. | |
| 4 | |
| 5 package lib | |
| 6 | |
| 7 import ( | |
| 8 "fmt" | |
| 9 "io/ioutil" | |
| 10 "os" | |
| 11 "testing" | |
| 12 | |
| 13 . "github.com/smartystreets/goconvey/convey" | |
| 14 | |
| 15 . "github.com/luci/luci-go/common/testing/assertions" | |
| 16 ) | |
| 17 | |
| 18 func TestAcquireExclusiveLock(t *testing.T) { | |
| 19 lockDir, err := ioutil.TempDir("/tmp", "") | |
| 20 if err != nil { | |
| 21 t.Error("received error creating temporary testing directory") | |
| 22 } | |
| 23 defer os.Remove(lockDir) | |
| 24 path := lockDir + ".lock" | |
| 25 | |
| 26 Convey("AcquireExclusiveLock errors if lock file doesn't exist", t, func (c C) { | |
| 27 So(AcquireExclusiveLock(path), ShouldErrLike, fmt.Sprintf("canno t acquire lock on %s because file does not exist", path)) | |
|
iannucci
2017/07/12 01:34:59
tbh, "file does not exist" is enough of a substrin
charliea (OOO until 10-5)
2017/07/12 02:17:17
I went with "lock file does not exist"
| |
| 28 }) | |
| 29 } | |
| OLD | NEW |