sync: migrate ai-operator to Gitea (2026-08-10)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package ari
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLockFile(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "listener.lock")
|
||||
first, err := AcquireLock(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if second, err := AcquireLock(path); err == nil {
|
||||
_ = second.Release()
|
||||
t.Fatal("second lock should fail")
|
||||
}
|
||||
if err := first.Release(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
third, err := AcquireLock(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_ = third.Release()
|
||||
}
|
||||
Reference in New Issue
Block a user