Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/memory/allocator_concurrent_test.go

25 lines
431 B

package memory
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestAllocator_lock(t *testing.T) {
var alloc Allocator
t.Run("can lock and unlock without panic", func(t *testing.T) {
require.NotPanics(t, func() {
alloc.lock()
alloc.unlock()
})
})
t.Run("cannot double-lock", func(t *testing.T) {
require.PanicsWithValue(t, errConcurrentUse, func() {
alloc.lock()
alloc.lock()
})
})
}