Commit Graph

3 Commits

Author SHA1 Message Date
Valentin Rothberg e72d18e1d7 lockfile test: make concurrent RW test determinisitc
Inspired by the stdlib's rwmutex tests, we are using counter and
different valid ranges for reader and writers.  Also use a channel to
synchronize on Goroutine completion.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-04-09 10:30:26 +02:00
Valentin Rothberg 5c5dc645d9 lockfile test: make concurrent read tests deterministic
Make the cocurrent read tests deterministic by synchronizing the
gouroutines with three channels.  The code is inspired by the
stdlib's rwmutex tests.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-04-07 15:24:25 +02:00
Nalin Dahyabhai aa5c9b7871 lockfile: add some unit tests
These aren't exhaustive, but they're something.

Also change Modified() to not return an ENOSPC error when the length of
the last-writer ID doesn't match the one we'd use, since it's enough
that it's different from the one we'd use, whatever its length.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-28 13:03:18 -05:00