MCPcopy Create free account
hub / github.com/cloudbase/garm / TestLocalLockerLockUnlock

Method TestLocalLockerLockUnlock

locking/local_locker_test.go:39–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39func (l *LockerTestSuite) TestLocalLockerLockUnlock() {
40 l.mux.Lock("test", "test-identifier")
41 mux, ok := l.mux.muxes.Load("test")
42 l.Require().True(ok)
43 keyMux := mux.(*lockWithIdent)
44 l.Require().Equal("test-identifier", keyMux.ident)
45 l.mux.Unlock("test", true)
46 mux, ok = l.mux.muxes.Load("test")
47 l.Require().False(ok)
48 l.Require().Nil(mux)
49 l.mux.Unlock("test", false)
50}
51
52func (l *LockerTestSuite) TestLocalLockerTryLock() {
53 locked := l.mux.TryLock("test", "test-identifier")

Callers

nothing calls this directly

Calls 2

LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected