Add BITFIELD_RO basic tests for non-repl use cases (#12187)

Current tests for BITFIELD_RO command are skipped in the external mode,
and therefore reply-schemas-validator reports a coverage error.
This PR adds basic tests to increase coverage.
This commit is contained in:
Hanna Fadida 2023-05-18 12:16:46 +03:00 committed by GitHub
parent 40e6131ba5
commit 37cf1984b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -214,6 +214,16 @@ start_server {tags {"bitops"}} {
} }
r del mystring r del mystring
} }
test {BITFIELD_RO with only key as argument} {
set res [r bitfield_ro bits]
assert {$res eq {}}
}
test {BITFIELD_RO fails when write option is used} {
catch {r bitfield_ro bits set u8 0 100 get u8 0} err
assert_match {*ERR BITFIELD_RO only supports the GET subcommand*} $err
}
} }
start_server {tags {"repl external:skip"}} { start_server {tags {"repl external:skip"}} {
@ -240,12 +250,12 @@ start_server {tags {"repl external:skip"}} {
assert_equal 100 [$slave bitfield_ro bits get u8 0] assert_equal 100 [$slave bitfield_ro bits get u8 0]
} }
test {BITFIELD_RO with only key as argument} { test {BITFIELD_RO with only key as argument on read-only replica} {
set res [$slave bitfield_ro bits] set res [$slave bitfield_ro bits]
assert {$res eq {}} assert {$res eq {}}
} }
test {BITFIELD_RO fails when write option is used} { test {BITFIELD_RO fails when write option is used on read-only replica} {
catch {$slave bitfield_ro bits set u8 0 100 get u8 0} err catch {$slave bitfield_ro bits set u8 0 100 get u8 0} err
assert_match {*ERR BITFIELD_RO only supports the GET subcommand*} $err assert_match {*ERR BITFIELD_RO only supports the GET subcommand*} $err
} }