add using lazy connect (#122)
Some checks failed
codeql / analyze (go) (push) Failing after 1m2s
build / test (push) Failing after 5m0s
build / lint (push) Successful in 9m35s

Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
Reviewed-on: #122
Co-authored-by: Evstigneev Denis <danteevstigneev@yandex.ru>
Co-committed-by: Evstigneev Denis <danteevstigneev@yandex.ru>
This commit is contained in:
2024-11-27 01:57:39 +03:00
parent 77fe9cbef6
commit 24f9f41de4
5 changed files with 139 additions and 58 deletions

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"os"
"sync/atomic"
"testing"
"time"
@@ -40,7 +41,7 @@ func TestKeepTTL(t *testing.T) {
}
r := NewStore(store.Addrs(os.Getenv("STORE_NODES")))
if err := r.Init(); err != nil {
if err := r.Init(store.LazyConnect(true)); err != nil {
t.Fatal(err)
}
if err := r.Connect(ctx); err != nil {
@@ -119,9 +120,11 @@ func Test_rkv_configure(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
b := atomic.Bool{}
rc := &Store{
opts: tt.fields.options,
cli: tt.fields.Client,
opts: tt.fields.options,
cli: tt.fields.Client,
connected: &b,
}
err := rc.configure()
if (err != nil) != tt.wantErr {