2024-02-12 14:31:57 +03:00
|
|
|
package v1
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2024-02-12 14:55:05 +03:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/suite"
|
2024-02-12 14:31:57 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type StorageTest struct {
|
|
|
|
suite.Suite
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestStorage(t *testing.T) {
|
|
|
|
suite.Run(t, new(StorageTest))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *StorageTest) Test_MGClientPool() {
|
|
|
|
clientPool, err := NewMGClientPool(1)
|
|
|
|
t.Assert().NoError(err)
|
|
|
|
|
|
|
|
client := clientPool.Get("test_token", "test_url")
|
|
|
|
t.Assert().Equal("test_url", client.URL)
|
|
|
|
|
|
|
|
clientPool.Remove("test_token")
|
|
|
|
clientPool.Close()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *StorageTest) Test_NegativeCapacity() {
|
|
|
|
_, err := NewMGClientPool(-1)
|
2024-02-12 14:55:05 +03:00
|
|
|
t.Assert().Equal(ErrNegativeCapacity.Error(), err.Error())
|
2024-02-12 14:31:57 +03:00
|
|
|
}
|