mirror of
https://github.com/tiennm99/keepalive.git
synced 2026-10-16 16:15:49 +00:00
fix(couchbase): restore readiness timeout
This commit is contained in:
1 parent
0ad7fbebfc
commit
77b08464b0
4 files changed
+8
-8
No files matched your search
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/couchbase/gocb/v2"
|
||||
)
|
||||
|
||||
const defaultCouchbaseReadyTimeout = 2 * time.Minute
|
||||
const defaultCouchbaseReadyTimeout = 30 * time.Second
|
||||
|
||||
func (a *couchbaseAdapter) bucketReadyError(err error) error {
|
||||
return fmt.Errorf(
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestCouchbaseFactoryParsesInitializationOptions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCouchbaseFactoryUsesHostedReadyTimeoutDefault(t *testing.T) {
|
||||
func TestCouchbaseFactoryUsesReadyTimeoutDefault(t *testing.T) {
|
||||
a, err := New("couchbase", Config{
|
||||
"connection_string": "couchbases://cb.example.com",
|
||||
"username": "user",
|
||||
@@ -45,8 +45,8 @@ func TestCouchbaseFactoryUsesHostedReadyTimeoutDefault(t *testing.T) {
|
||||
}
|
||||
|
||||
got := a.(*couchbaseAdapter)
|
||||
if got.readyTimeout != 2*time.Minute {
|
||||
t.Fatalf("readyTimeout = %s, want 2m", got.readyTimeout)
|
||||
if got.readyTimeout != 30*time.Second {
|
||||
t.Fatalf("readyTimeout = %s, want 30s", got.readyTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,13 +67,13 @@ func TestCouchbaseFactoryRejectsInvalidReadyTimeout(t *testing.T) {
|
||||
|
||||
func TestCouchbaseBucketReadyErrorAddsActionableContext(t *testing.T) {
|
||||
cause := errors.New("unambiguous timeout")
|
||||
a := couchbaseAdapter{bucket: "keepalive", readyTimeout: 2 * time.Minute}
|
||||
a := couchbaseAdapter{bucket: "keepalive", readyTimeout: 30 * time.Second}
|
||||
|
||||
err := a.bucketReadyError(cause)
|
||||
if !errors.Is(err, cause) {
|
||||
t.Fatalf("bucketReadyError does not wrap cause: %v", err)
|
||||
}
|
||||
for _, want := range []string{"keepalive", "2m0s", "Capella allowed IP", "ready_timeout"} {
|
||||
for _, want := range []string{"keepalive", "30s", "Capella allowed IP", "ready_timeout"} {
|
||||
if !strings.Contains(err.Error(), want) {
|
||||
t.Fatalf("bucketReadyError() = %q, want it to contain %q", err, want)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user