github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/store/redis/lock_test.go (about)

     1  package redis
     2  
     3  import (
     4  	"context"
     5  	"time"
     6  )
     7  
     8  func (s *RediaronTestSuite) TestCreateLock() {
     9  	ctx := context.Background()
    10  
    11  	lock, err := s.rediaron.CreateLock("test", time.Second)
    12  	s.NoError(err)
    13  	s.NotNil(lock)
    14  
    15  	_, err = lock.Lock(ctx)
    16  	s.NoError(err)
    17  
    18  	err = lock.Unlock(ctx)
    19  	s.NoError(err)
    20  }