github.com/mutagen-io/mutagen@v0.18.0-rc1/pkg/daemon/lock_test.go (about)

     1  package daemon
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  // TestLockCycle tests an acquisition/release cycle of the daemon lock.
     8  func TestLockCycle(t *testing.T) {
     9  	// Attempt to acquire the daemon lock.
    10  	lock, err := AcquireLock()
    11  	if err != nil {
    12  		t.Fatal("unable to acquire lock:", err)
    13  	}
    14  
    15  	// Release the lock.
    16  	if err := lock.Release(); err != nil {
    17  		t.Fatal("unable to release lock:", err)
    18  	}
    19  }