valkey icon indicating copy to clipboard operation
valkey copied to clipboard

[NEW] Introduce automated cross version and cross fork testing infrastructure

Open hpatro opened this issue 1 year ago • 16 comments

DESCRIPTION

Introduce cross version/cross fork integration testing infrastructure. With the compatibility version release and planned new major version release, it will be good to improve the testing/release certification process. This will help Valkey to prepare for release(s) more confidently and avoid pain for user(s) during migration/upgrade(s).

Example Scenario:

Issue: https://github.com/redis/redis/issues/12685

Redis 7.2 introduced cluster bus message extensions feature by default and it caused failure of engine upgrade from older version (i.e. Redis 6.2 or lower) due to message broadcasted from engine running 7.2 not being compatible in older versions.

PR to fix the issue during upgrade: https://github.com/valkey-io/valkey/pull/52

hpatro avatar Mar 29 '24 05:03 hpatro

@valkey-io/core-team WDYT ?

hpatro avatar Mar 29 '24 05:03 hpatro

It would be great if anyone wants to add such tests, because we're a bit overloaded at this point. It doesn't have to be in TCL (maybe Python instead?) and it doesn't even have to be in this repo, if we're testing different forks. We can make a separate interop testing repo. It is about

  • cluster bus (nodes of different versions in the same cluster)
  • replication (primary/replica of different versions)
  • RDB and AOF files (read and write by different versions)
  • Anything else?

zuiderkwast avatar Apr 02 '24 10:04 zuiderkwast

i am willing to spend time. if anyone guide me some starting point.

pragnesh avatar Apr 03 '24 10:04 pragnesh

We can make a separate interop testing repo. It is about

I think it should be this repo, I don't think we want to start introducing tests elsewhere for now.

madolson avatar Apr 04 '24 01:04 madolson

I'm fine either way, but what id'd like to see is some prototyping to get something running. Use any language, any client lib, but be ready to discard it later.

zuiderkwast avatar Apr 04 '24 07:04 zuiderkwast

There are potential benefits of having a completely separate repo for this. It would need to check out various versions of valkey anyway (so it can't just run out of the checked out repo). It could also test valkey against various forks and versions. We can have test a cluster with mixed nodes of KeyDB, Dragonfly, Redict, Redis, Valkey, various versions. We can run redis testsuites on the valkey binary. Etc.

zuiderkwast avatar Apr 04 '24 10:04 zuiderkwast

@madolson @zuiderkwast @pragnesh @mattsta Hi everyone! Is anyone already working on this? We currently have a Python test script that provides the same functionality as the TCL tests, but written in Python. It has been working well for the past two years and has significantly improved the efficiency of writing and debugging tests compared to TCL. Here is a relatively old version: https://pypi.org/project/pybbt/ If you're interested, I'm willing to spend 1-2 weeks adapting it for Valkey and writing a few test examples.

suxb201 avatar Apr 17 '24 09:04 suxb201

@suxb201 how is the test setup/teardown done? How long does a similar tcl test takes in python?

hpatro avatar Apr 17 '24 18:04 hpatro

@hpatro

  1. To create an instance, use a clear statement.
  2. Instances made inside an @subcase are safely destroyed when the @subcase ends.
  3. Instances created within an @case will be destroyed when the @case concludes.
  4. The @subcase is concurrent, which makes testing efficient.
  5. There is only one @case per file, and the tests are composed of multiple files.
  6. Logs, AOF and RDB files will be arranged in a temporary directory, making it easier to debug.

Here's a example:

from testsuite import *


# Master can replicate command longer than client-query-buffer-limit on replica
@subcase()
def replication_query_buffer_limit():
    t0 = Tair()  # create a process
    t1 = Tair()  # create another process
    t1.wait_slaveof(t0)  # call 'slaveof' and then wait for the replication connection to be set up
    t0.do("config", "set", "client-query-buffer-limit", 2000000)
    t1.do("config", "set", "client-query-buffer-limit", 1048576)  # 1024*1024 = 1mb

    value = "x" * 1100000
    ASSERT_TRUE(t0.do("set", "k", value))  # 2000000 > 1100000 > 1048576
    t0.wait_consistent()
    ASSERT_EQ(t1.do("get", "k"), value.encode())
    ASSERT_EQ(t1.digest(), t0.digest())


@case(tags=["flag0", "flag1", "flag2"])
def main():
    replication_query_buffer_limit()


if __name__ == '__main__':
    main()

suxb201 avatar Apr 18 '24 07:04 suxb201

It seems to me that porting the tests to a different language is a different topic. I think it can be discussed here: #94.

Personally, I think it would be beneficial to create a separate interoperability-testing repo where scripts and CI jobs can

  • check out multiple versions of Valkey, Redis, clients and other tools
  • test mixed clusters, e.g. test #52
  • test replication between different versions
  • create dumps (rdb and aof) and load them it in other versions, newer and older

@bjosv

zuiderkwast avatar Apr 18 '24 11:04 zuiderkwast