diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 277fa38038b..5b7e6732844 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -94,6 +94,7 @@ set ::all_tests { unit/client-eviction unit/violations unit/replybufsize + unit/client } # Index to the next test to run in the ::all_tests list. set ::next_test 0 diff --git a/tests/unit/client.tcl b/tests/unit/client.tcl new file mode 100644 index 00000000000..a66db58f73f --- /dev/null +++ b/tests/unit/client.tcl @@ -0,0 +1,59 @@ +start_server {} { + test {CLIENT Caching wrong number of arguments} { + catch {r client caching} err + set _ $err + } {ERR*wrong number of arguments*} + + test {CLIENT Caching test tracking} { + # Checks if the CLIENT_TRACKING flag is working as intended + r CLIENT TRACKING off optout + catch {r client caching on} err + set _ $err + } {ERR*when the client is in tracking mode*} + + test {CLIENT Caching ON with optout} { + r CLIENT TRACKING ON optout + catch {r client caching on} err + set _ $err + } {ERR*syntax*} + + test {CLIENT kill wrong address or no port} { + catch {r client kill 999.999.999.000:} err + set _ $err + } {ERR*No such*} + + test {CLIENT no-evict wrong argument} { + catch {r client no-evict wrongInput} err + set _ $err + } {ERR*syntax*} + + test {CLIENT pause wrong timeout type} { + catch {r client pause abc} err + set _ $err + } {ERR*timeout is not an integer*} + + test {CLIENT pause negative timeout} { + catch {r client pause -1} err + set _ $err + } {ERR timeout is negative} + + test {CLIENT reply wrong argument} { + catch {r client reply wrongInput} err + set _ $err + } {ERR*syntax*} + + test {CLIENT tracking wrong argument} { + catch {r client tracking wrongInput} err + set _ $err + } {ERR*syntax*} + + test {CLIENT tracking wrong option} { + catch {r client tracking on wrongInput} err + set _ $err + } {ERR*syntax*} + + test {CLIENT getname check if name set correctly} { + r client setname testName + r client getName + } {testName} +}