forked from tarantool/go-tarantool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcall_17_test.go
54 lines (44 loc) · 1.22 KB
/
call_17_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//go:build go_tarantool_call_17
// +build go_tarantool_call_17
package tarantool_test
import (
"testing"
. "github.com/tarantool/go-tarantool"
"github.com/tarantool/go-tarantool/test_helpers"
)
func TestConnection_Call(t *testing.T) {
var resp *Response
var err error
conn := test_helpers.ConnectWithValidation(t, server, opts)
defer conn.Close()
// Call17
resp, err = conn.Call17("simple_concat", []interface{}{"1"})
if err != nil {
t.Errorf("Failed to use Call")
}
if val, ok := resp.Data[0].(string); !ok || val != "11" {
t.Errorf("result is not {{1}} : %v", resp.Data)
}
}
func TestCallRequest(t *testing.T) {
var resp *Response
var err error
conn := test_helpers.ConnectWithValidation(t, server, opts)
defer conn.Close()
req := NewCallRequest("simple_concat").Args([]interface{}{"1"})
resp, err = conn.Do(req).Get()
if err != nil {
t.Errorf("Failed to use Call")
}
if val, ok := resp.Data[0].(string); !ok || val != "11" {
t.Errorf("result is not {{1}} : %v", resp.Data)
}
}
func TestCallRequestCode(t *testing.T) {
req := NewCallRequest("simple_concat")
code := req.Code()
expected := Call17RequestCode
if code != int32(expected) {
t.Errorf("CallRequest actual code %v != %v", code, expected)
}
}