generated from duckdb/extension-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathredis.test
More file actions
123 lines (100 loc) · 2.73 KB
/
redis.test
File metadata and controls
123 lines (100 loc) · 2.73 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# name: test/sql/redis.test
# description: test redis extension
# group: [redis]
# Require statement will ensure this test is run with this extension loaded
require redis
# Test that scalar functions exist and have proper error handling for missing secrets
statement error
SELECT redis_get('mykey', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_set('mykey', 'myvalue', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_hget('myhash', 'field1', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_hset('myhash', 'field1', 'value1', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_lpush('mylist', 'value1', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_lrange('mylist', 0, -1, 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_mget('key1,key2', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_scan('0', '*', 100, 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_hscan('myhash', '0', '*', 100, 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_del('mykey', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_exists('mykey', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_type('mykey', 'nonexistent_secret');
----
Redis secret not found
# Test table functions exist and have proper error handling for missing secrets
statement error
SELECT * FROM redis_keys('*', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT * FROM redis_hgetall('myhash', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT * FROM redis_lrange_table('mylist', 0, -1, 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT * FROM redis_hscan_over_scan('*', '*', 100, 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_expire('mykey', 3600, 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_ttl('mykey', 'nonexistent_secret');
----
Redis secret not found
statement error
SELECT redis_expireat('mykey', 1736918400, 'nonexistent_secret');
----
Redis secret not found
# Test that we can create a redis secret
statement ok
CREATE SECRET my_test_secret (
TYPE redis,
HOST 'localhost',
PORT '6379',
PASSWORD ''
);
# Test that the secret is properly created (connection will fail but secret exists)
# This tests that the secret lookup works - the connection error proves we found the secret
statement error
SELECT redis_get('mykey', 'my_test_secret');
----
Redis connection error
# Cleanup
statement ok
DROP SECRET my_test_secret;