Skip to content

Commit

Permalink
dynamolock: prove that nil locks correctly report as expired
Browse files Browse the repository at this point in the history
  • Loading branch information
ucirello committed Nov 14, 2019
1 parent b8c5b96 commit f2e2ef4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lock_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,23 @@ limitations under the License.

package dynamolock

import "testing"

// RVN exposes internal record version number for testing only.
func (l *Lock) RVN() string {
l.semaphore.Lock()
defer l.semaphore.Unlock()
return l.recordVersionNumber
}

func TestExpiredNilLock(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Fatal("unexpected panic:", r)
}
}()
var l *Lock
if !l.IsExpired() {
t.Fatal("nil locks should report as expired")
}
}

0 comments on commit f2e2ef4

Please sign in to comment.