2022-04-16 16:36:43 +03:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
"time"
|
2023-07-29 00:40:58 +03:00
|
|
|
|
|
|
|
"go.unistack.org/micro/v4/options"
|
2022-04-16 16:36:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewClientCallOptions(t *testing.T) {
|
|
|
|
var flag bool
|
|
|
|
w := func(fn CallFunc) CallFunc {
|
|
|
|
flag = true
|
|
|
|
return fn
|
|
|
|
}
|
|
|
|
c := NewClientCallOptions(NewClient(),
|
2023-07-29 00:40:58 +03:00
|
|
|
options.Address("127.0.0.1"),
|
2022-04-16 16:36:43 +03:00
|
|
|
WithCallWrapper(w),
|
2023-07-29 00:40:58 +03:00
|
|
|
RequestTimeout(1*time.Millisecond),
|
|
|
|
Retries(0),
|
|
|
|
Backoff(BackoffInterval(10*time.Millisecond, 100*time.Millisecond)),
|
2022-04-16 16:36:43 +03:00
|
|
|
)
|
|
|
|
_ = c.Call(context.TODO(), c.NewRequest("service", "endpoint", nil), nil)
|
|
|
|
if !flag {
|
|
|
|
t.Fatalf("NewClientCallOptions not works")
|
|
|
|
}
|
|
|
|
}
|