dragonfly icon indicating copy to clipboard operation
dragonfly copied to clipboard

Node-Redis integration test against dragonfly

Open odedponcz opened this issue 2 years ago • 6 comments

Run integration test with Node-Redis. Fail on 13 tests. 361 passing (2s) 42 pending 13 failing

  1. LINSERT client.lInsert: ERR no such key

In Redis: 127.0.0.1:6379> linsert key BEFORE pivot element (integer) 0 In Dragonfly: 127.0.0.1:6379> linsert key BEFORE pivot element (error) ERR no such key

  1. LPUSHX client.lPushX: ERR no such key

  2. RPUSHX client.rPushX: ERR no such key

  3. CLIENT PAUSE client.clientPause: ERR Unknown subcommand or wrong number of arguments for 'PAUSE'. Try CLIENT HELP.

  4. COMMAND INFO client.commandInfo PING: ERR syntax error

  5. COMMAND INFO client.commandInfo DOSE_NOT_EXISTS: ERR syntax error

  6. COMMAND client.command: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:

  • actual - expected

  • undefined

  • {

  • arity: -1,

  • categories: Set(0) {},

  • firstKeyIndex: 0,

  • flags: Set(2) {

  • 'fast',
    
  • 'stale'
    
  • },

  • lastKeyIndex: 0,

  • name: 'ping',

  • step: 0

  • } at assertPingCommand (lib/commands/COMMAND_INFO.spec.ts:7:12) at /home/oded/stratto/node-redis/packages/client/lib/commands/COMMAND.spec.ts:15:26 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Context. (/home/oded/stratto/node-redis/packages/test-utils/dist/index.js:79:17)

    1. XGROUP CREATE client.xGroupCreate: ERR The XGROUP subcommand requires the key to exist. Note that for CREATE you may want to use the MKSTREAM option to create an empty stream automatically.

    2. XGROUP DELCONSUMER client.xGroupDelConsumer: ERR The XGROUP subcommand requires the key to exist. Note that for CREATE you may want to use the MKSTREAM option to create an empty stream automatically.

    3. XGROUP DESTROY client.xGroupDestroy: ERR The XGROUP subcommand requires the key to exist. Note that for CREATE you may want to use the MKSTREAM option to create an empty stream automatically.

    4. XGROUP SETID client.xGroupSetId: ERR The XGROUP subcommand requires the key to exist. Note that for CREATE you may want to use the MKSTREAM option to create an empty stream automatically.

    5. XINFO GROUPS client.xInfoGroups: ERR The XGROUP subcommand requires the key to exist. Note that for CREATE you may want to use the MKSTREAM option to create an empty stream automatically.

    6. "after all" hook in "{root}": Error: docker rm error - Error: No such container: unknown

      at dockerRemove (/home/oded/stratto/node-redis/packages/test-utils/dist/dockers.js:60:15) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async /home/oded/stratto/node-redis/packages/test-utils/dist/dockers.js:64:83 at async Promise.all (index 0)

To Reproduce Steps to reproduce the behavior:

  1. Get Dragonfly running on your machine (docker or compile and run your own)
  2. Get the node-redis fork: git clone https://github.com/dragonflydb/node-redis.git
  3. Switch to brantch dragonfly: git switch dragonfly (the main branch will always be a clean fork from origin. We will keep our changes in the dragonfly branch)
  4. Install dependencies: npm install
  5. To build the client: npm run build -w ./packages/client
  6. To build the test: npm run build -w ./packages/test-utils
  7. To run the test with a max redis version of 2.8 : npm run test -w ./packages/client -- --redis-version=2.8
  8. See error

Expected behavior All tests passing. Some tests will be on pending since we disabled cluster and configured the redis version to 2.8

Env:

  • Dragonfly Version 0.6.0

Reproducible Code Snippet

git clone https://github.com/dragonflydb/node-redis.git
cd node-redis
git switch dragonfly
npm install
npm run build -w ./packages/client
npm run build -w ./packages/test-utils
npm run test -w ./packages/client -- --redis-version=2.8

odedponcz avatar Aug 07 '22 16:08 odedponcz

in the same environment, if you are running Node-Redis integration test with just the original Redis (not Redis inside DF), would these 13 cases also fail?

junpengqiu avatar Oct 18 '22 04:10 junpengqiu

no, those tests pass.

romange avatar Oct 18 '22 05:10 romange

Came across this issue, specifically:

The XGROUP subcommand requires the key to exist. Note that for CREATE you may want to use the MKSTREAM option to create an empty stream automatically.

To reproduce with DragonflyDB 1.2.1:

127.0.0.1:6379> XGROUP CREATE test test 0 MKSTREAM
(error) ERR The XGROUP subcommand requires the key to exist. Note that for CREATE you may want to use the MKSTREAM option to create an empty stream automatically.

While works well with Redis 7.0.8:

127.0.0.1:6379> XGROUP CREATE test test 0 MKSTREAM
OK

BTW, if the group already exists then Redis provides the following output:

(error) BUSYGROUP Consumer Group name already exists

Just mentioning because when implementing queue based on Redis stream many implementations rely on the BUSYGROUP prefix to detect that group already exists and the error may be ignored.

Seems like in 5 of 13 failures above the error is the same and may come from the same thing.

Also, tried to issue XGROUP HELP command, in this case DragonflyDB crashed with the following stack trace:

F20230429 06:34:09.582751    10 transaction.cc:238] Check failed: absl::StartsWith(cid_->name(), "EVAL") XGROUP
*** Check failure stack trace: ***
    @     0x55f803813f03  (unknown)
    @     0x55f80380c6c7  (unknown)
    @     0x55f80380e04f  (unknown)
    @     0x55f8036103cb  (unknown)
    @     0x55f80361171b  (unknown)
    @     0x55f80377bd9d  (unknown)
    @     0x55f8035eb3ed  (unknown)
    @     0x55f8035ef704  (unknown)
    @     0x55f8035aedd2  (unknown)
    @     0x55f8035a4067  (unknown)
    @     0x55f80388337f  (unknown)
*** SIGABRT received at time=1682750049 on cpu 0 ***
PC: @     0x7f67ae75e00b  (unknown)  raise
[failure_signal_handler.cc : 332] RAW: Signal 11 raised at PC=0x7f67ae73d941 while already in AbslFailureSignalHandler()
*** SIGSEGV received at time=1682750049 on cpu 0 ***
PC: @     0x7f67ae73d941  (unknown)  abort

FZambia avatar Apr 29 '23 06:04 FZambia

Hi @FZambia , Do you use streams in centrifuge? Or is it for something else? Currently, Dragonfly does not support streams API - it seems to be not very popular in the Redis ecosystem.

romange avatar Apr 29 '23 07:04 romange

@romange hello! Yes, it's for Centrifugo - using a queue, based on Redis streams (mostly following principles described in https://redis.io/docs/data-types/streams-tutorial/) for push notifications feature. Not an urgent thing, but hopefully one day it will also work with DragonflyDB.

Regarding other functionality the only test which is still broken is iterating over the message in stream in reversed order. In this case the reason seems to be https://github.com/dragonflydb/dragonfly/issues/856. This is not common thing for the use case of Centrifuge/Centrifugo - but again, would be nice to eventually have it working.

FZambia avatar Apr 29 '23 09:04 FZambia

@FZambia https://github.com/dragonflydb/dragonfly/pull/1159 will fix the crash issue.

romange avatar Apr 29 '23 16:04 romange