-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cross-version replication test #1371
base: unstable
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,15 @@ jobs: | |
# Fail build if there are warnings | ||
# build with TLS just for compilation coverage | ||
run: make -j4 all-with-unit-tests SERVER_CFLAGS='-Werror' BUILD_TLS=yes USE_FAST_FLOAT=yes | ||
- name: install old server for compatibility testing | ||
run: | | ||
cd tests/tmp | ||
wget https://download.valkey.io/releases/valkey-7.2.7-focal-x86_64.tar.gz | ||
tar -xvf valkey-7.2.7-focal-x86_64.tar.gz | ||
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer this to be in a script which can be invoked by multiple tests and provide engine version as parameter and skip downloading if it already exists. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking keep it minimal and that we can add some abstraction for it when we need it. What kind of script do you have in mind? A python script under utils/, a yaml file under .github/ or a TCL script under tests/? If we put it under utils/, does that mean we officially support the script? If we add a script with these few lines, is the version parameter a string like "7.2.7" and we assume the rest of the URLs are always identical? What if we're testing something from another URL, or with a different executable name (an old redis-server, kvdb-server, etc.) Then the parameters are bigger than the script itself. So far, we don't have any scripts that downloads anything from hard-coded URLs, apart from in the CI jobs, so it think this might be the best place for it. Can we add some github action definition that can be used from multiple github actions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sticking to Github actions options seems problematic i.e. how do other vendors/users test backward compatibility locally? My thought is to have a python script with well defined old server name+version (enum) and download path (doesn't need to be identical). And yes, we would need to support it officially. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Like this:
You may want to build it from source, either a source release or a git checkout, even to test a development branch against unstable. Using a binary release from our website was just a simple way to get the CI running. Not sure it's the best way or a method I want to officially support.
It seems like a commitment to support a bunch of URLs to binary releases. I don't really see the benefit. Is it to have predictable tests? Each compatiblity test uses a fixed version, so it knows what to expect? Keep in mind that it's also a different binary for a different architecture and per OS. To run it on ARM, you can't use the same binary. There are even differences between ubuntu versions, like OpenSSL version and such things. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For daily are we going to run it against all supported versions? That can also be a followup. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, sounds good, and we should add some more meaningful test cases too, like the one we wanted for the light-weight cluster message and the cluster ping-extension issues we've had in the past. I just wanted to create the scaffolding and a simple test case first. |
||
- name: test | ||
run: | | ||
sudo apt-get install tcl8.6 tclx | ||
./runtest --verbose --tags -slow --dump-logs | ||
./runtest --verbose --tags -slow --dump-logs --old-server-path tests/tmp/valkey-7.2.7-focal-x86_64/bin/valkey-server | ||
- name: module api test | ||
run: CFLAGS='-Werror' ./runtest-moduleapi --verbose --dump-logs | ||
- name: validate commands.def up to date | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Test replication from an older version primary. | ||
# | ||
# Use minimal.conf to make sure we don't use any configs not supported on the old version. | ||
|
||
proc server_name_and_version {} { | ||
set server_name [s server_name] | ||
if {$server_name eq {}} { | ||
set server_name redis | ||
} | ||
set server_version [s "${server_name}_version"] | ||
return "$server_name $server_version" | ||
} | ||
|
||
start_server {tags {"repl needs:old-server external:skip"} start-old-server 1 config "minimal.conf"} { | ||
set primary_name_and_version [server_name_and_version] | ||
r set foo bar | ||
|
||
start_server {} { | ||
test "Start replication from $primary_name_and_version" { | ||
r replicaof [srv -1 host] [srv -1 port] | ||
wait_for_sync r | ||
# The key has been transferred. | ||
assert_equal bar [r get foo] | ||
assert_equal up [s master_link_status] | ||
} | ||
|
||
test "Replicate a SET command from $primary_name_and_version" { | ||
r -1 set baz quux | ||
wait_for_ofs_sync [srv 0 client] [srv -1 client] | ||
set reply [r get baz] | ||
assert_equal $reply quux | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ set ::single_tests {} | |
set ::run_solo_tests {} | ||
set ::skip_till "" | ||
set ::external 0; # If "1" this means, we are running against external instance | ||
set ::old_server_path {}; # Used in upgrade and inter-version tests | ||
set ::file ""; # If set, runs only the tests in this comma separated list | ||
set ::curfile ""; # Hold the filename of the current suite | ||
set ::accurate 0; # If true runs fuzz tests with more iterations | ||
|
@@ -600,6 +601,9 @@ proc print_help_screen {} { | |
"--tls-module Run tests in TLS mode with Valkey module." | ||
"--host <addr> Run tests against an external host." | ||
"--port <port> TCP port to use against external host." | ||
"--old-server-path <path>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about words like "other", "alternative" server, etc. This is how I thought when I picked "old":
Not sure the above are important though and I understand your point that we can also test against something like KeyDB, AWS MemoryDB, Rockskv, etc. Also the same Valkey version compiled in different ways, with/without some modules, without Lua, etc, etc. Yes, there are definitely more use cases than old and new, so I agree something like "other" is more generic. Other just means not the system under test, which is what matters here. "Compat" doesn't seem general enough though. We may (hypothetically) want to test something against some incompatible version to test the failure modes (e.g. that we log some error and don't crash). I'll change to "other" then, unless you have more ideas or pros/cons. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I proposed secondary in my other comment, I like other too. I don't really like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've heard secondary in the context of primary-secondary, meaning primary-replica. I prefer "other" so far. The essence is that it's a different one than the SUT one. Other = different. We could use "different", but |
||
" Path to another version of valkey-server, used for inter-version" | ||
" compatibility testing." | ||
"--baseport <port> Initial port number for spawned valkey servers." | ||
"--portcount <num> Port range for spawned valkey servers." | ||
"--singledb Use a single database, avoid SELECT." | ||
|
@@ -673,6 +677,9 @@ for {set j 0} {$j < [llength $argv]} {incr j} { | |
} elseif {$opt eq {--port}} { | ||
set ::port $arg | ||
incr j | ||
} elseif {$opt eq {--old-server-path}} { | ||
set ::old_server_path $arg | ||
incr j | ||
} elseif {$opt eq {--baseport}} { | ||
set ::baseport $arg | ||
incr j | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I guess we might theoretically do other types of compatibility, maybe something like: