mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
17 lines
240 B
Go
17 lines
240 B
Go
package utils
|
|
|
|
import "testing"
|
|
import "github.com/stretchr/testify/assert"
|
|
|
|
func TestTryLock(t *testing.T) {
|
|
lock := MutexWithTry{}
|
|
defer lock.Unlock()
|
|
|
|
l := lock.TryLock()
|
|
assert.True(t, l)
|
|
|
|
l = lock.TryLock()
|
|
assert.False(t, l)
|
|
|
|
}
|