From 00439e23f3d95f993fc506c649bea6285245ddf8 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 16 Apr 2022 16:36:43 +0300 Subject: [PATCH] add client call options tests Signed-off-by: Vasiliy Tolstov --- client/client_call_options_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 client/client_call_options_test.go diff --git a/client/client_call_options_test.go b/client/client_call_options_test.go new file mode 100644 index 00000000..2cffdf36 --- /dev/null +++ b/client/client_call_options_test.go @@ -0,0 +1,26 @@ +package client + +import ( + "context" + "testing" + "time" +) + +func TestNewClientCallOptions(t *testing.T) { + var flag bool + w := func(fn CallFunc) CallFunc { + flag = true + return fn + } + c := NewClientCallOptions(NewClient(), + WithAddress("127.0.0.1"), + WithCallWrapper(w), + WithRequestTimeout(1*time.Millisecond), + WithRetries(0), + WithBackoff(BackoffInterval(10*time.Millisecond, 100*time.Millisecond)), + ) + _ = c.Call(context.TODO(), c.NewRequest("service", "endpoint", nil), nil) + if !flag { + t.Fatalf("NewClientCallOptions not works") + } +}