@@ -11,29 +11,56 @@ import (
11
11
12
12
"github.com/ydb-platform/ydb-go-sdk/v3/table"
13
13
"github.com/ydb-platform/ydb-go-sdk/v3/table/options"
14
+ "github.com/ydb-platform/ydb-go-sdk/v3/table/types"
14
15
"github.com/ydb-platform/ydb-go-sdk/v3/testutil"
15
16
)
16
17
17
18
func TestQueryCachePolicyKeepInCache (t * testing.T ) {
18
19
for _ , test := range [... ]struct {
19
20
name string
21
+ params * table.QueryParameters
20
22
executeDataQueryOptions []options.ExecuteDataQueryOption
21
23
keepInCache bool
22
24
}{
23
25
{
24
- name : "no options" ,
26
+ name : "no params, no options" ,
27
+ params : table .NewQueryParameters (),
28
+ executeDataQueryOptions : nil ,
29
+ keepInCache : false ,
30
+ },
31
+ {
32
+ name : "not empty params, no options" ,
33
+ params : table .NewQueryParameters (table .ValueParam ("a" , types .UTF8Value ("b" ))),
25
34
executeDataQueryOptions : nil ,
26
35
keepInCache : true ,
27
36
},
28
37
{
29
- name : "with server cache" ,
38
+ name : "no params, with server cache" ,
39
+ params : table .NewQueryParameters (),
30
40
executeDataQueryOptions : []options.ExecuteDataQueryOption {
31
41
options .WithKeepInCache (true ),
32
42
},
33
43
keepInCache : true ,
34
44
},
35
45
{
36
- name : "no server cache" ,
46
+ name : "not empty params, with server cache" ,
47
+ params : table .NewQueryParameters (table .ValueParam ("a" , types .UTF8Value ("b" ))),
48
+ executeDataQueryOptions : []options.ExecuteDataQueryOption {
49
+ options .WithKeepInCache (true ),
50
+ },
51
+ keepInCache : true ,
52
+ },
53
+ {
54
+ name : "no params, no server cache" ,
55
+ params : table .NewQueryParameters (),
56
+ executeDataQueryOptions : []options.ExecuteDataQueryOption {
57
+ options .WithKeepInCache (false ),
58
+ },
59
+ keepInCache : false ,
60
+ },
61
+ {
62
+ name : "not empty params, no server cache" ,
63
+ params : table .NewQueryParameters (table .ValueParam ("a" , types .UTF8Value ("b" ))),
37
64
executeDataQueryOptions : []options.ExecuteDataQueryOption {
38
65
options .WithKeepInCache (false ),
39
66
},
@@ -81,7 +108,7 @@ func TestQueryCachePolicyKeepInCache(t *testing.T) {
81
108
table .CommitTx (),
82
109
),
83
110
"SELECT 1" ,
84
- table . NewQueryParameters () ,
111
+ test . params ,
85
112
test .executeDataQueryOptions ... ,
86
113
)
87
114
if err != nil {
0 commit comments