Skip to content

Commit 18214be

Browse files
hpatrozuiderkwast
andauthored
Add compatibility test with Valkey 7.2/8.0 (#2342)
* Add cross version compatibility test to run with Valkey 7.2 and 8.0 * Add mechanism in TCL test to skip tests dynamically - #2711 --------- Signed-off-by: Harkrishn Patro <harkrisp@amazon.com> Signed-off-by: Harkrishn Patro <bunty.hari@gmail.com> Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
1 parent f598d11 commit 18214be

File tree

3 files changed

+53
-9
lines changed

3 files changed

+53
-9
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,12 @@ jobs:
2828
# Fail build if there are warnings
2929
# build with TLS just for compilation coverage
3030
run: make -j4 all-with-unit-tests SERVER_CFLAGS='-Werror' BUILD_TLS=yes USE_FAST_FLOAT=yes
31-
- name: install old server for compatibility testing
32-
run: |
33-
cd tests/tmp
34-
wget https://download.valkey.io/releases/valkey-8.1.3-noble-x86_64.tar.gz
35-
tar -xvf valkey-8.1.3-noble-x86_64.tar.gz
3631
- name: test
3732
run: |
3833
sudo apt-get install tcl8.6 tclx
39-
./runtest --verbose --tags -slow --dump-logs --other-server-path tests/tmp/valkey-8.1.3-noble-x86_64/bin/valkey-server
34+
./runtest --verbose --tags -slow --dump-logs
4035
- name: module api test
41-
run: CFLAGS='-Werror' ./runtest-moduleapi --verbose --dump-logs --other-server-path tests/tmp/valkey-8.1.3-noble-x86_64/bin/valkey-server
36+
run: CFLAGS='-Werror' ./runtest-moduleapi --verbose --dump-logs
4237
- name: validate commands.def up to date
4338
run: |
4439
touch src/commands/ping.json
@@ -49,6 +44,40 @@ jobs:
4944
run: |
5045
./src/valkey-unit-tests
5146
47+
test-ubuntu-latest-compatibility:
48+
runs-on: ubuntu-latest
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
server:
53+
- {version: "7.2.10", file: "valkey-7.2.10-noble-x86_64.tar.gz"}
54+
- {version: "8.0.4", file: "valkey-8.0.4-noble-x86_64.tar.gz"}
55+
- {version: "8.1.3", file: "valkey-8.1.3-noble-x86_64.tar.gz"}
56+
steps:
57+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
58+
- name: make
59+
# Fail build if there are warnings
60+
# build with TLS just for compilation coverage
61+
run: make -j4 all-with-unit-tests SERVER_CFLAGS='-Werror' BUILD_TLS=yes USE_FAST_FLOAT=yes
62+
63+
- name: Install old server (${{ matrix.server.version }}) for compatibility testing
64+
run: |
65+
mkdir -p tests/tmp
66+
cd tests/tmp
67+
wget https://download.valkey.io/releases/${{ matrix.server.file }}
68+
tar -xvf ${{ matrix.server.file }}
69+
70+
- name: Run compatibility tests against ${{ matrix.server.version }}
71+
run: |
72+
sudo apt-get install -y tcl8.6 tclx
73+
./runtest --verbose --tags "-slow needs:other-server" --dump-logs \
74+
--other-server-path tests/tmp/valkey-${{ matrix.server.version }}-noble-x86_64/bin/valkey-server
75+
76+
- name: Module API tests against ${{ matrix.server.version }}
77+
run: |
78+
CFLAGS='-Werror' ./runtest-moduleapi --tags needs:other-server --verbose --dump-logs \
79+
--other-server-path tests/tmp/valkey-${{ matrix.server.version }}-noble-x86_64/bin/valkey-server
80+
5281
test-ubuntu-latest-cmake:
5382
runs-on: ubuntu-latest
5483
steps:

tests/support/test.tcl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ proc fail {msg} {
1010
error "assertion:$msg"
1111
}
1212

13+
proc skip {msg} {
14+
error "skipped:$msg"
15+
}
16+
1317
proc assert {condition} {
1418
if {![uplevel 1 [list expr $condition]]} {
1519
set context "(context: [info frame -1])"
@@ -256,7 +260,12 @@ proc test {name code {okpattern undefined} {tags {}}} {
256260
set test_start_time [clock milliseconds]
257261
if {[catch {set retval [uplevel 1 $code]} error]} {
258262
set assertion [string match "assertion:*" $error]
259-
if {$assertion || $::durable} {
263+
set skip [string match "skipped:*" $error]
264+
if {$skip} {
265+
incr ::num_skipped
266+
set msg [string range $error 8 end]
267+
send_data_packet $::test_server_fd skip "$::cur_test: $msg"
268+
} elseif {$assertion || $::durable} {
260269
# durable prevents the whole tcl test from exiting on an exception.
261270
# an assertion is handled gracefully anyway.
262271
set msg [string range $error 10 end]

tests/unit/cluster/cross-version-cluster.tcl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ tags {external:skip needs:other-server cluster singledb} {
1616
set primary_port [srv 0 port]
1717
set primary_id [$primary cluster myid]
1818

19-
start_server {config "minimal-cluster.conf" start-other-server 1 overrides {cluster-ping-interval 1000 rdb-version-check relaxed}} {
19+
start_server {config "minimal-cluster.conf" start-other-server 1 overrides {cluster-ping-interval 1000}} {
20+
set res [dict get [r hello] version]
21+
assert [regexp {([0-9]+)\.([0-9]+)\.[0-9]+} $res -> major minor]
22+
if {($major < 8) || ($major == 8 && $minor < 1)} {
23+
skip "Requires Valkey 8.1 or above"
24+
}
25+
r config set rdb-version-check relaxed
2026
# Add a replica of the old version to the cluster
2127
r cluster meet $primary_host $primary_port
2228
wait_for_cluster_propagation

0 commit comments

Comments
 (0)