diff options
author | Oran Agra <oran@redislabs.com> | 2022-02-07 00:10:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 00:10:05 +0200 |
commit | 98b3f52599cc3106ddc882d0dcc744bcaf9e0264 (patch) | |
tree | 4d80b5b816c5f442da277dfc72cfa8d594222630 /tests/support | |
parent | 91cc2059f5566ca7d22557df7fe47860d93d0009 (diff) | |
download | redis-98b3f52599cc3106ddc882d0dcc744bcaf9e0264.tar.gz |
add test suite infra to test RESP3 attributes (#10247)
So far we only tested attributes using readraw, not the
resp parser caches them, so that after getting the reply,
you can query them if you want.
Diffstat (limited to 'tests/support')
-rw-r--r-- | tests/support/redis.tcl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/support/redis.tcl b/tests/support/redis.tcl index 2c89de6ce..5743be5f4 100644 --- a/tests/support/redis.tcl +++ b/tests/support/redis.tcl @@ -35,6 +35,7 @@ array set ::redis::addr {} array set ::redis::blocking {} array set ::redis::deferred {} array set ::redis::readraw {} +array set ::redis::attributes {} ;# Holds the RESP3 attributes from the last call array set ::redis::reconnect {} array set ::redis::tls {} array set ::redis::callback {} @@ -105,6 +106,7 @@ proc ::redis::__dispatch__raw__ {id method argv} { set argv [lrange $argv 0 end-1] } if {[info command ::redis::__method__$method] eq {}} { + catch {unset ::redis::attributes($id)} set cmd "*[expr {[llength $argv]+1}]\r\n" append cmd "$[string length $method]\r\n$method\r\n" foreach a $argv { @@ -165,6 +167,7 @@ proc ::redis::__method__close {id fd} { catch {unset ::redis::blocking($id)} catch {unset ::redis::deferred($id)} catch {unset ::redis::readraw($id)} + catch {unset ::redis::attributes($id)} catch {unset ::redis::reconnect($id)} catch {unset ::redis::tls($id)} catch {unset ::redis::state($id)} @@ -185,6 +188,10 @@ proc ::redis::__method__readraw {id fd val} { set ::redis::readraw($id) $val } +proc ::redis::__method__attributes {id fd} { + set _ $::redis::attributes($id) +} + proc ::redis::redis_write {fd buf} { puts -nonewline $fd $buf } @@ -286,8 +293,8 @@ proc ::redis::redis_read_reply {id fd} { * {return [redis_multi_bulk_read $id $fd]} % {return [redis_read_map $id $fd]} | { - # ignore attributes for now (nowhere to store them) - redis_read_map $id $fd + set attrib [redis_read_map $id $fd] + set ::redis::attributes($id) $attrib continue } default { |