From a2b11c9b7c065d1f34a38806cc710cab78bb09ba Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Tue, 24 Aug 2021 15:57:18 -0400 Subject: [PATCH 01/17] Update test cases for sentinel (#12) * Update test cases * Minor changes * Update 05-manual.tcl * Update 10-replica-priority.tcl --- tests/sentinel/tests/00-base.tcl | 6 ++++++ tests/sentinel/tests/02-slaves-reconf.tcl | 7 +++++++ tests/sentinel/tests/05-manual.tcl | 7 ++++++- tests/sentinel/tests/07-down-conditions.tcl | 11 ++++++++++- tests/sentinel/tests/09-acl-support.tcl | 1 - tests/sentinel/tests/10-replica-priority.tcl | 7 +++++-- tests/sentinel/tests/11-port-0.tcl | 2 +- 7 files changed, 35 insertions(+), 6 deletions(-) diff --git a/tests/sentinel/tests/00-base.tcl b/tests/sentinel/tests/00-base.tcl index a1bbb278933..f00efc61e37 100644 --- a/tests/sentinel/tests/00-base.tcl +++ b/tests/sentinel/tests/00-base.tcl @@ -2,6 +2,10 @@ source "../tests/includes/start-init-tests.tcl" source "../tests/includes/init-tests.tcl" +foreach_sentinel_id id { + S $id sentinel debug default-down-after 1000 +} + if {$::simulate_error} { test "This test will fail" { fail "Simulated error" @@ -14,6 +18,8 @@ test "Basic failover works if the master is down" { assert {[lindex $addr 1] == $old_port} kill_instance redis $master_id foreach_sentinel_id id { + S $id sentinel debug ping-period 100 + S $id sentinel debug ask-period 100 wait_for_condition 1000 50 { [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port } else { diff --git a/tests/sentinel/tests/02-slaves-reconf.tcl b/tests/sentinel/tests/02-slaves-reconf.tcl index 9edf775ecae..8196b60fac3 100644 --- a/tests/sentinel/tests/02-slaves-reconf.tcl +++ b/tests/sentinel/tests/02-slaves-reconf.tcl @@ -48,6 +48,13 @@ proc 02_crash_and_failover {} { 02_test_slaves_replication 02_crash_and_failover + +foreach_sentinel_id id { + S $id sentinel debug info-period 100 + S $id sentinel debug default-down-after 1000 + S $id sentinel debug publish-period 100 +} + 02_test_slaves_replication test "Kill a slave instance" { diff --git a/tests/sentinel/tests/05-manual.tcl b/tests/sentinel/tests/05-manual.tcl index c97a0e53c51..28c5560a6aa 100644 --- a/tests/sentinel/tests/05-manual.tcl +++ b/tests/sentinel/tests/05-manual.tcl @@ -2,6 +2,12 @@ source "../tests/includes/init-tests.tcl" +foreach_sentinel_id id { + S $id sentinel debug info-period 1000 + S $id sentinel debug default-down-after 3000 + S $id sentinel debug publish-period 500 +} + test "Manual failover works" { set old_port [RPort $master_id] set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] @@ -42,4 +48,3 @@ test "The old master eventually gets reconfigured as a slave" { fail "Old master not reconfigured as slave of new master" } } - diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index 19cabde49bc..2c72f85470b 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -5,6 +5,10 @@ source "../../../tests/support/cli.tcl" set ::alive_sentinel [expr {$::instances_count/2+2}] proc ensure_master_up {} { + S $::alive_sentinel sentinel debug info-period 1000 + S $::alive_sentinel sentinel debug ping-period 100 + S $::alive_sentinel sentinel debug ask-period 100 + S $::alive_sentinel sentinel debug publish-period 100 wait_for_condition 1000 50 { [dict get [S $::alive_sentinel sentinel master mymaster] flags] eq "master" } else { @@ -12,7 +16,12 @@ proc ensure_master_up {} { } } + proc ensure_master_down {} { + S $::alive_sentinel sentinel debug info-period 1000 + S $::alive_sentinel sentinel debug ping-period 100 + S $::alive_sentinel sentinel debug ask-period 100 + S $::alive_sentinel sentinel debug publish-period 100 wait_for_condition 1000 50 { [string match *down* \ [dict get [S $::alive_sentinel sentinel master mymaster] flags]] @@ -30,7 +39,7 @@ test "Crash the majority of Sentinels to prevent failovers for this unit" { test "SDOWN is triggered by non-responding but not crashed instance" { lassign [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port ensure_master_up - exec ../../../src/redis-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 10 > /dev/null & + exec ../../../src/redis-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 3 > /dev/null & ensure_master_down ensure_master_up } diff --git a/tests/sentinel/tests/09-acl-support.tcl b/tests/sentinel/tests/09-acl-support.tcl index 1366fc4d502..8c967f0bca7 100644 --- a/tests/sentinel/tests/09-acl-support.tcl +++ b/tests/sentinel/tests/09-acl-support.tcl @@ -47,4 +47,3 @@ test "SENTINEL CONFIG SET handles on-the-fly credentials reconfiguration" { test "(post-cleanup) Tear down ACL configuration" { teardown_acl } - diff --git a/tests/sentinel/tests/10-replica-priority.tcl b/tests/sentinel/tests/10-replica-priority.tcl index 00248a734b2..d3f868afab6 100644 --- a/tests/sentinel/tests/10-replica-priority.tcl +++ b/tests/sentinel/tests/10-replica-priority.tcl @@ -33,9 +33,11 @@ proc 10_test_number_of_replicas {n_replicas_expected} { test "Check sentinel replies with $n_replicas_expected replicas" { # ensure sentinels replies with the right number of replicas foreach_sentinel_id id { - # retries 40 x 500ms = 20s as SENTINEL_INFO_PERIOD = 10s + S $id sentinel debug info-period 100 + S $id sentinel debug default-down-after 1000 + S $id sentinel debug publish-period 100 set len [llength [S $id SENTINEL REPLICAS mymaster]] - wait_for_condition 40 500 { + wait_for_condition 200 100 { [llength [S $id SENTINEL REPLICAS mymaster]] == $n_replicas_expected } else { fail "Sentinel replies with a wrong number of replicas with replica-announced=yes (expected $n_replicas_expected but got $len) on sentinel $id" @@ -71,3 +73,4 @@ proc 10_set_replica_announced {master_id announced n_replicas} { 10_set_replica_announced $master_id "yes" "all" # ensure all replicas are not announced by sentinels 10_test_number_of_replicas 4 + diff --git a/tests/sentinel/tests/11-port-0.tcl b/tests/sentinel/tests/11-port-0.tcl index e7bfdcc7348..a3e8bdba1cf 100644 --- a/tests/sentinel/tests/11-port-0.tcl +++ b/tests/sentinel/tests/11-port-0.tcl @@ -20,7 +20,7 @@ test "Start/Stop sentinel on same port with a different runID should not change set pid [exec_instance "sentinel" $dirname $orgfilename] lappend ::pids $pid - after 5000 + after 1000 # Get new count of total sentinel set b [S 0 SENTINEL master mymaster] From d8a00c347557d203b9d448b6cbfa5e22b35ea5e1 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Tue, 24 Aug 2021 15:57:18 -0400 Subject: [PATCH 02/17] Update test cases for sentinel (#12) * Update test cases * Minor changes * Update 05-manual.tcl * Update 10-replica-priority.tcl --- tests/sentinel/tests/00-base.tcl | 6 ++++++ tests/sentinel/tests/02-slaves-reconf.tcl | 7 +++++++ tests/sentinel/tests/05-manual.tcl | 7 ++++++- tests/sentinel/tests/07-down-conditions.tcl | 11 ++++++++++- tests/sentinel/tests/09-acl-support.tcl | 1 - tests/sentinel/tests/10-replica-priority.tcl | 7 +++++-- tests/sentinel/tests/11-port-0.tcl | 2 +- 7 files changed, 35 insertions(+), 6 deletions(-) diff --git a/tests/sentinel/tests/00-base.tcl b/tests/sentinel/tests/00-base.tcl index a1bbb278933..f00efc61e37 100644 --- a/tests/sentinel/tests/00-base.tcl +++ b/tests/sentinel/tests/00-base.tcl @@ -2,6 +2,10 @@ source "../tests/includes/start-init-tests.tcl" source "../tests/includes/init-tests.tcl" +foreach_sentinel_id id { + S $id sentinel debug default-down-after 1000 +} + if {$::simulate_error} { test "This test will fail" { fail "Simulated error" @@ -14,6 +18,8 @@ test "Basic failover works if the master is down" { assert {[lindex $addr 1] == $old_port} kill_instance redis $master_id foreach_sentinel_id id { + S $id sentinel debug ping-period 100 + S $id sentinel debug ask-period 100 wait_for_condition 1000 50 { [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port } else { diff --git a/tests/sentinel/tests/02-slaves-reconf.tcl b/tests/sentinel/tests/02-slaves-reconf.tcl index 9edf775ecae..8196b60fac3 100644 --- a/tests/sentinel/tests/02-slaves-reconf.tcl +++ b/tests/sentinel/tests/02-slaves-reconf.tcl @@ -48,6 +48,13 @@ proc 02_crash_and_failover {} { 02_test_slaves_replication 02_crash_and_failover + +foreach_sentinel_id id { + S $id sentinel debug info-period 100 + S $id sentinel debug default-down-after 1000 + S $id sentinel debug publish-period 100 +} + 02_test_slaves_replication test "Kill a slave instance" { diff --git a/tests/sentinel/tests/05-manual.tcl b/tests/sentinel/tests/05-manual.tcl index c97a0e53c51..28c5560a6aa 100644 --- a/tests/sentinel/tests/05-manual.tcl +++ b/tests/sentinel/tests/05-manual.tcl @@ -2,6 +2,12 @@ source "../tests/includes/init-tests.tcl" +foreach_sentinel_id id { + S $id sentinel debug info-period 1000 + S $id sentinel debug default-down-after 3000 + S $id sentinel debug publish-period 500 +} + test "Manual failover works" { set old_port [RPort $master_id] set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] @@ -42,4 +48,3 @@ test "The old master eventually gets reconfigured as a slave" { fail "Old master not reconfigured as slave of new master" } } - diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index 19cabde49bc..2c72f85470b 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -5,6 +5,10 @@ source "../../../tests/support/cli.tcl" set ::alive_sentinel [expr {$::instances_count/2+2}] proc ensure_master_up {} { + S $::alive_sentinel sentinel debug info-period 1000 + S $::alive_sentinel sentinel debug ping-period 100 + S $::alive_sentinel sentinel debug ask-period 100 + S $::alive_sentinel sentinel debug publish-period 100 wait_for_condition 1000 50 { [dict get [S $::alive_sentinel sentinel master mymaster] flags] eq "master" } else { @@ -12,7 +16,12 @@ proc ensure_master_up {} { } } + proc ensure_master_down {} { + S $::alive_sentinel sentinel debug info-period 1000 + S $::alive_sentinel sentinel debug ping-period 100 + S $::alive_sentinel sentinel debug ask-period 100 + S $::alive_sentinel sentinel debug publish-period 100 wait_for_condition 1000 50 { [string match *down* \ [dict get [S $::alive_sentinel sentinel master mymaster] flags]] @@ -30,7 +39,7 @@ test "Crash the majority of Sentinels to prevent failovers for this unit" { test "SDOWN is triggered by non-responding but not crashed instance" { lassign [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port ensure_master_up - exec ../../../src/redis-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 10 > /dev/null & + exec ../../../src/redis-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 3 > /dev/null & ensure_master_down ensure_master_up } diff --git a/tests/sentinel/tests/09-acl-support.tcl b/tests/sentinel/tests/09-acl-support.tcl index 1366fc4d502..8c967f0bca7 100644 --- a/tests/sentinel/tests/09-acl-support.tcl +++ b/tests/sentinel/tests/09-acl-support.tcl @@ -47,4 +47,3 @@ test "SENTINEL CONFIG SET handles on-the-fly credentials reconfiguration" { test "(post-cleanup) Tear down ACL configuration" { teardown_acl } - diff --git a/tests/sentinel/tests/10-replica-priority.tcl b/tests/sentinel/tests/10-replica-priority.tcl index 00248a734b2..d3f868afab6 100644 --- a/tests/sentinel/tests/10-replica-priority.tcl +++ b/tests/sentinel/tests/10-replica-priority.tcl @@ -33,9 +33,11 @@ proc 10_test_number_of_replicas {n_replicas_expected} { test "Check sentinel replies with $n_replicas_expected replicas" { # ensure sentinels replies with the right number of replicas foreach_sentinel_id id { - # retries 40 x 500ms = 20s as SENTINEL_INFO_PERIOD = 10s + S $id sentinel debug info-period 100 + S $id sentinel debug default-down-after 1000 + S $id sentinel debug publish-period 100 set len [llength [S $id SENTINEL REPLICAS mymaster]] - wait_for_condition 40 500 { + wait_for_condition 200 100 { [llength [S $id SENTINEL REPLICAS mymaster]] == $n_replicas_expected } else { fail "Sentinel replies with a wrong number of replicas with replica-announced=yes (expected $n_replicas_expected but got $len) on sentinel $id" @@ -71,3 +73,4 @@ proc 10_set_replica_announced {master_id announced n_replicas} { 10_set_replica_announced $master_id "yes" "all" # ensure all replicas are not announced by sentinels 10_test_number_of_replicas 4 + diff --git a/tests/sentinel/tests/11-port-0.tcl b/tests/sentinel/tests/11-port-0.tcl index e7bfdcc7348..a3e8bdba1cf 100644 --- a/tests/sentinel/tests/11-port-0.tcl +++ b/tests/sentinel/tests/11-port-0.tcl @@ -20,7 +20,7 @@ test "Start/Stop sentinel on same port with a different runID should not change set pid [exec_instance "sentinel" $dirname $orgfilename] lappend ::pids $pid - after 5000 + after 1000 # Get new count of total sentinel set b [S 0 SENTINEL master mymaster] From 535a37f511ac98c6fdae10998e414c4ba816af83 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Sat, 11 Sep 2021 09:51:28 -0400 Subject: [PATCH 03/17] Update daily.yml --- .github/workflows/daily.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 80001650876..fd502d39175 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -23,7 +23,7 @@ on: default: '' use_repo: description: 'repo owner and name' - default: 'redis/redis' + default: 'hwware/redis' use_git_ref: description: 'git branch or sha to use' default: 'unstable' @@ -33,7 +33,7 @@ jobs: test-ubuntu-jemalloc: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' + if: github.repository == 'hwware/redis' timeout-minutes: 14400 steps: - name: prep @@ -67,7 +67,7 @@ jobs: test-ubuntu-libc-malloc: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' + if: github.repository == 'hwware/redis' timeout-minutes: 14400 steps: - name: prep @@ -98,7 +98,7 @@ jobs: test-ubuntu-no-malloc-usable-size: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' + if: github.repository == 'hwware/redis' timeout-minutes: 14400 steps: - name: prep @@ -129,7 +129,7 @@ jobs: test-ubuntu-32bit: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, '32bit') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, '32bit') timeout-minutes: 14400 steps: - name: prep @@ -166,7 +166,7 @@ jobs: test-ubuntu-tls: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'tls') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'tls') timeout-minutes: 14400 steps: - name: prep @@ -208,7 +208,7 @@ jobs: test-ubuntu-io-threads: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'iothreads') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'iothreads') timeout-minutes: 14400 steps: - name: prep @@ -234,7 +234,7 @@ jobs: test-valgrind: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'valgrind') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'valgrind') timeout-minutes: 14400 steps: - name: prep @@ -265,7 +265,7 @@ jobs: test-valgrind-no-malloc-usable-size: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'valgrind') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'valgrind') timeout-minutes: 14400 steps: - name: prep @@ -292,7 +292,7 @@ jobs: test-centos7-jemalloc: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' + if: github.repository == 'hwware/redis' container: centos:7 timeout-minutes: 14400 steps: @@ -326,7 +326,7 @@ jobs: test-centos7-tls: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'tls') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'tls') container: centos:7 timeout-minutes: 14400 steps: @@ -371,7 +371,7 @@ jobs: test-macos-latest: runs-on: macos-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'macos') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'macos') timeout-minutes: 14400 steps: - name: prep @@ -400,7 +400,7 @@ jobs: test-freebsd: runs-on: macos-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'freebsd') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'freebsd') timeout-minutes: 14400 steps: - name: prep @@ -427,7 +427,7 @@ jobs: test-alpine-jemalloc: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'alpine') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'alpine') container: alpine:latest steps: - name: prep @@ -460,7 +460,7 @@ jobs: test-alpine-libc-malloc: runs-on: ubuntu-latest - if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'alpine') + if: github.repository == 'hwware/redis' && !contains(github.event.inputs.skipjobs, 'alpine') container: alpine:latest steps: - name: prep From e0753dbcf9041d3552aeab04b8038c4e22e856f4 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 09:44:39 -0400 Subject: [PATCH 04/17] Update 07-down-conditions.tcl --- tests/sentinel/tests/07-down-conditions.tcl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index 2c72f85470b..3f3500bd1c4 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -5,10 +5,6 @@ source "../../../tests/support/cli.tcl" set ::alive_sentinel [expr {$::instances_count/2+2}] proc ensure_master_up {} { - S $::alive_sentinel sentinel debug info-period 1000 - S $::alive_sentinel sentinel debug ping-period 100 - S $::alive_sentinel sentinel debug ask-period 100 - S $::alive_sentinel sentinel debug publish-period 100 wait_for_condition 1000 50 { [dict get [S $::alive_sentinel sentinel master mymaster] flags] eq "master" } else { @@ -16,12 +12,7 @@ proc ensure_master_up {} { } } - proc ensure_master_down {} { - S $::alive_sentinel sentinel debug info-period 1000 - S $::alive_sentinel sentinel debug ping-period 100 - S $::alive_sentinel sentinel debug ask-period 100 - S $::alive_sentinel sentinel debug publish-period 100 wait_for_condition 1000 50 { [string match *down* \ [dict get [S $::alive_sentinel sentinel master mymaster] flags]] From 647d9096a493973c00885875f3106ad9b6377e1f Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 10:06:12 -0400 Subject: [PATCH 05/17] Update ci.yml --- .github/workflows/ci.yml | 300 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 298 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5e3a97c62f..680b1f0355a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,6 @@ jobs: run: | apt-get update && apt-get install -y build-essential make REDIS_CFLAGS='-Werror' - build-macos-latest: runs-on: macos-latest steps: @@ -44,7 +43,6 @@ jobs: run: | sudo apt-get update && sudo apt-get install libc6-dev-i386 make REDIS_CFLAGS='-Werror' 32bit - build-libc-malloc: runs-on: ubuntu-latest steps: @@ -61,3 +59,301 @@ jobs: run: | yum -y install gcc make make REDIS_CFLAGS='-Werror' + test-ubuntu-jemalloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make REDIS_CFLAGS='-Werror -DREDIS_TEST' + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + - name: unittest + run: ./src/redis-server test all + + test-ubuntu-libc-malloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make MALLOC=libc + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-ubuntu-no-malloc-usable-size: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make MALLOC=libc CFLAGS=-DNO_MALLOC_USABLE_SIZE + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-ubuntu-32bit: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + sudo apt-get update && sudo apt-get install libc6-dev-i386 + make 32bit REDIS_CFLAGS='-Werror -DREDIS_TEST' + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: | + make -C tests/modules 32bit + ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + - name: unittest + run: ./src/redis-server test all + + test-ubuntu-tls: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + make BUILD_TLS=yes + - name: testprep + run: | + sudo apt-get install tcl8.6 tclx tcl-tls + ./utils/gen-test-certs.sh + - name: test + run: | + ./runtest --accurate --verbose --tls --dump-logs + ./runtest --accurate --verbose --dump-logs + - name: module api test + run: | + ./runtest-moduleapi --verbose --tls + ./runtest-moduleapi --verbose + - name: sentinel tests + run: | + ./runtest-sentinel --tls + ./runtest-sentinel + - name: cluster tests + run: | + ./runtest-cluster --tls + ./runtest-cluster + + test-ubuntu-io-threads: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + make + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network --dump-logs + - name: cluster tests + run: ./runtest-cluster --config io-threads 4 --config io-threads-do-reads yes + + test-valgrind: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make valgrind REDIS_CFLAGS='-Werror -DREDIS_TEST' + - name: testprep + run: | + sudo apt-get update + sudo apt-get install tcl8.6 tclx valgrind -y + - name: test + run: ./runtest --valgrind --verbose --clients 1 --tags -large-memory --dump-logs + - name: module api test + run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 + - name: unittest + run: | + valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all + if grep -q 0x err.txt; then cat err.txt; exit 1; fi + + test-valgrind-no-malloc-usable-size: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE" + - name: testprep + run: | + sudo apt-get update + sudo apt-get install tcl8.6 tclx valgrind -y + - name: test + run: ./runtest --valgrind --verbose --clients 1 --tags -large-memory --dump-logs + - name: module api test + run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 + + test-centos7-jemalloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + container: centos:7 + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + yum -y install gcc make + make + - name: testprep + run: yum -y install which tcl tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-centos7-tls: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + container: centos:7 + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + yum -y install centos-release-scl epel-release + yum -y install devtoolset-7 openssl-devel openssl + scl enable devtoolset-7 "make BUILD_TLS=yes" + - name: testprep + run: | + yum -y install tcl tcltls tclx + ./utils/gen-test-certs.sh + - name: test + run: | + ./runtest --accurate --verbose --tls --dump-logs + ./runtest --accurate --verbose --dump-logs + - name: module api test + run: | + ./runtest-moduleapi --verbose --tls + ./runtest-moduleapi --verbose + - name: sentinel tests + run: | + ./runtest-sentinel --tls + ./runtest-sentinel + - name: cluster tests + run: | + ./runtest-cluster --tls + ./runtest-cluster + test-macos-latest: + runs-on: macos-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make + - name: test + run: ./runtest --accurate --verbose --no-latency --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-freebsd: + runs-on: macos-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: test + uses: vmactions/freebsd-vm@v0.1.4 + with: + usesh: true + sync: rsync + prepare: pkg install -y bash gmake lang/tcl86 lang/tclx + run: > + gmake || exit 1 ; + if true ; then ./runtest --accurate --verbose --no-latency --tags -large-memory --dump-logs || exit 1 ; fi ; + if true ; then MAKE=gmake ./runtest-moduleapi --verbose || exit 1 ; fi ; + if true ; then ./runtest-sentinel || exit 1 ; fi ; + if true ; then ./runtest-cluster || exit 1 ; fi ; + test-alpine-jemalloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + container: alpine:latest + steps: + - uses: actions/checkout@v2 + - name: make + run: | + apk add build-base + make REDIS_CFLAGS='-Werror' + - name: testprep + run: apk add tcl procps tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-alpine-libc-malloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + container: alpine:latest + steps: + - uses: actions/checkout@v2 + - name: make + run: | + apk add build-base + make REDIS_CFLAGS='-Werror' USE_JEMALLOC=no CFLAGS=-DUSE_MALLOC_USABLE_SIZE + - name: testprep + run: apk add tcl procps tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster \ No newline at end of file From 81ac89465d00bd7808a51292f5129c44a0fe088f Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 10:38:19 -0400 Subject: [PATCH 06/17] Update ci.yml --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 680b1f0355a..66fd06810f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,8 +69,6 @@ jobs: run: make REDIS_CFLAGS='-Werror -DREDIS_TEST' - name: testprep run: sudo apt-get install tcl8.6 tclx - - name: test - run: ./runtest --accurate --verbose --dump-logs - name: module api test run: ./runtest-moduleapi --verbose - name: sentinel tests @@ -109,8 +107,6 @@ jobs: run: make MALLOC=libc CFLAGS=-DNO_MALLOC_USABLE_SIZE - name: testprep run: sudo apt-get install tcl8.6 tclx - - name: test - run: ./runtest --accurate --verbose --dump-logs - name: module api test run: ./runtest-moduleapi --verbose - name: sentinel tests From 3295baac4cf0437e509992a4280900186e44b41e Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 10:54:42 -0400 Subject: [PATCH 07/17] Update to test 7 and ci --- .github/workflows/ci.yml | 4 ++++ tests/sentinel/tests/07-down-conditions.tcl | 1 + 2 files changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66fd06810f9..680b1f0355a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,6 +69,8 @@ jobs: run: make REDIS_CFLAGS='-Werror -DREDIS_TEST' - name: testprep run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs - name: module api test run: ./runtest-moduleapi --verbose - name: sentinel tests @@ -107,6 +109,8 @@ jobs: run: make MALLOC=libc CFLAGS=-DNO_MALLOC_USABLE_SIZE - name: testprep run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs - name: module api test run: ./runtest-moduleapi --verbose - name: sentinel tests diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index 3f3500bd1c4..1a8867f23a6 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -61,6 +61,7 @@ test "SDOWN is triggered by misconfigured instance replying with errors" { R 0 config set dbfilename tmp R 0 config set save "1000000 1000000" R 0 bgsave + after 5000 ensure_master_down R 0 config set save $orig_save R 0 config set dir $orig_dir From 9fb1abbbe3d9b9f449f999519d2cd75323fc63cb Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 11:22:08 -0400 Subject: [PATCH 08/17] Update 07-down-conditions.tcl --- tests/sentinel/tests/07-down-conditions.tcl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index 1a8867f23a6..1fd37210da5 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -3,6 +3,13 @@ source "../tests/includes/init-tests.tcl" source "../../../tests/support/cli.tcl" +foreach_sentinel_id id { + S $id sentinel debug info-period 1000 + S $id sentinel debug ask-period 1000 + S $id sentinel debug default-down-after 3000 + S $id sentinel debug publish-period 1000 +} + set ::alive_sentinel [expr {$::instances_count/2+2}] proc ensure_master_up {} { wait_for_condition 1000 50 { From f24cc1a7ee6471304062b062cc2809a52444c400 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 12:15:38 -0400 Subject: [PATCH 09/17] Delete 07-down-conditions.tcl --- tests/sentinel/tests/07-down-conditions.tcl | 88 --------------------- 1 file changed, 88 deletions(-) delete mode 100644 tests/sentinel/tests/07-down-conditions.tcl diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl deleted file mode 100644 index 1fd37210da5..00000000000 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ /dev/null @@ -1,88 +0,0 @@ -# Test conditions where an instance is considered to be down - -source "../tests/includes/init-tests.tcl" -source "../../../tests/support/cli.tcl" - -foreach_sentinel_id id { - S $id sentinel debug info-period 1000 - S $id sentinel debug ask-period 1000 - S $id sentinel debug default-down-after 3000 - S $id sentinel debug publish-period 1000 -} - -set ::alive_sentinel [expr {$::instances_count/2+2}] -proc ensure_master_up {} { - wait_for_condition 1000 50 { - [dict get [S $::alive_sentinel sentinel master mymaster] flags] eq "master" - } else { - fail "Master flags are not just 'master'" - } -} - -proc ensure_master_down {} { - wait_for_condition 1000 50 { - [string match *down* \ - [dict get [S $::alive_sentinel sentinel master mymaster] flags]] - } else { - fail "Master is not flagged SDOWN" - } -} - -test "Crash the majority of Sentinels to prevent failovers for this unit" { - for {set id 0} {$id < $quorum} {incr id} { - kill_instance sentinel $id - } -} - -test "SDOWN is triggered by non-responding but not crashed instance" { - lassign [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port - ensure_master_up - exec ../../../src/redis-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 3 > /dev/null & - ensure_master_down - ensure_master_up -} - -test "SDOWN is triggered by crashed instance" { - lassign [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port - ensure_master_up - kill_instance redis 0 - ensure_master_down - restart_instance redis 0 - ensure_master_up -} - -test "SDOWN is triggered by masters advertising as slaves" { - ensure_master_up - R 0 slaveof 127.0.0.1 34567 - ensure_master_down - R 0 slaveof no one - ensure_master_up -} - -test "SDOWN is triggered by misconfigured instance replying with errors" { - ensure_master_up - set orig_dir [lindex [R 0 config get dir] 1] - set orig_save [lindex [R 0 config get save] 1] - # Set dir to / and filename to "tmp" to make sure it will fail. - R 0 config set dir / - R 0 config set dbfilename tmp - R 0 config set save "1000000 1000000" - R 0 bgsave - after 5000 - ensure_master_down - R 0 config set save $orig_save - R 0 config set dir $orig_dir - R 0 config set dbfilename dump.rdb - R 0 bgsave - ensure_master_up -} - -# We use this test setup to also test command renaming, as a side -# effect of the master going down if we send PONG instead of PING -test "SDOWN is triggered if we rename PING to PONG" { - ensure_master_up - S $::alive_sentinel SENTINEL SET mymaster rename-command PING PONG - ensure_master_down - S $::alive_sentinel SENTINEL SET mymaster rename-command PING PING - ensure_master_up -} From b58fb7a05e601c6728c42954ed427c347395bbbe Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 12:53:00 -0400 Subject: [PATCH 10/17] Create 07-down-conditions.tcl --- tests/sentinel/tests/07-down-conditions.tcl | 89 +++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 tests/sentinel/tests/07-down-conditions.tcl diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl new file mode 100644 index 00000000000..389797e5fe2 --- /dev/null +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -0,0 +1,89 @@ +# Test conditions where an instance is considered to be down + +source "../tests/includes/init-tests.tcl" +source "../../../tests/support/cli.tcl" + +foreach_sentinel_id id { + S $id sentinel debug info-period 10000 + S $id sentinel debug ask-period 1000 + S $id sentinel debug default-down-after 30000 + S $id sentinel debug publish-period 2000 + S $id sentinel debug ping-period 10000 +} + +set ::alive_sentinel [expr {$::instances_count/2+2}] +proc ensure_master_up {} { + wait_for_condition 1000 50 { + [dict get [S $::alive_sentinel sentinel master mymaster] flags] eq "master" + } else { + fail "Master flags are not just 'master'" + } +} + +proc ensure_master_down {} { + wait_for_condition 1000 50 { + [string match *down* \ + [dict get [S $::alive_sentinel sentinel master mymaster] flags]] + } else { + fail "Master is not flagged SDOWN" + } +} + +test "Crash the majority of Sentinels to prevent failovers for this unit" { + for {set id 0} {$id < $quorum} {incr id} { + kill_instance sentinel $id + } +} + +test "SDOWN is triggered by non-responding but not crashed instance" { + lassign [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port + ensure_master_up + exec ../../../src/redis-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 3 > /dev/null & + ensure_master_down + ensure_master_up +} + +test "SDOWN is triggered by crashed instance" { + lassign [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port + ensure_master_up + kill_instance redis 0 + ensure_master_down + restart_instance redis 0 + ensure_master_up +} + +test "SDOWN is triggered by masters advertising as slaves" { + ensure_master_up + R 0 slaveof 127.0.0.1 34567 + ensure_master_down + R 0 slaveof no one + ensure_master_up +} + +test "SDOWN is triggered by misconfigured instance replying with errors" { + ensure_master_up + set orig_dir [lindex [R 0 config get dir] 1] + set orig_save [lindex [R 0 config get save] 1] + # Set dir to / and filename to "tmp" to make sure it will fail. + R 0 config set dir / + R 0 config set dbfilename tmp + R 0 config set save "1000000 1000000" + R 0 bgsave + after 5000 + ensure_master_down + R 0 config set save $orig_save + R 0 config set dir $orig_dir + R 0 config set dbfilename dump.rdb + R 0 bgsave + ensure_master_up +} + +# We use this test setup to also test command renaming, as a side +# effect of the master going down if we send PONG instead of PING +test "SDOWN is triggered if we rename PING to PONG" { + ensure_master_up + S $::alive_sentinel SENTINEL SET mymaster rename-command PING PONG + ensure_master_down + S $::alive_sentinel SENTINEL SET mymaster rename-command PING PING + ensure_master_up +} From a80f021bf04ca2ffb17a40453ff97953f366cce4 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 13:35:01 -0400 Subject: [PATCH 11/17] Update 07-down-conditions.tcl --- tests/sentinel/tests/07-down-conditions.tcl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index 389797e5fe2..92d95c3ab2c 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -4,11 +4,11 @@ source "../tests/includes/init-tests.tcl" source "../../../tests/support/cli.tcl" foreach_sentinel_id id { - S $id sentinel debug info-period 10000 - S $id sentinel debug ask-period 1000 - S $id sentinel debug default-down-after 30000 - S $id sentinel debug publish-period 2000 - S $id sentinel debug ping-period 10000 + S $id sentinel debug info-period 1000 + S $id sentinel debug ask-period 100 + S $id sentinel debug default-down-after 3000 + S $id sentinel debug publish-period 200 + S $id sentinel debug ping-period 100 } set ::alive_sentinel [expr {$::instances_count/2+2}] @@ -68,6 +68,7 @@ test "SDOWN is triggered by misconfigured instance replying with errors" { R 0 config set dir / R 0 config set dbfilename tmp R 0 config set save "1000000 1000000" + after 5000 R 0 bgsave after 5000 ensure_master_down From 1bd9e09b3a7e80cb0d91f9eb2b09ba23d3b9a5c0 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 14:29:55 -0400 Subject: [PATCH 12/17] Test sentinel tests (#24) * Update test cases for sentinel (#12) * Update test cases * Minor changes * Update 05-manual.tcl * Update 10-replica-priority.tcl * Update 07-down-conditions.tcl * Update ci.yml * Update ci.yml * Update to test 7 and ci * Update 07-down-conditions.tcl * Delete 07-down-conditions.tcl * Create 07-down-conditions.tcl * Update 07-down-conditions.tcl --- .github/workflows/ci.yml | 300 +++++++++++++++++++- tests/sentinel/tests/07-down-conditions.tcl | 10 + 2 files changed, 308 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5e3a97c62f..680b1f0355a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,6 @@ jobs: run: | apt-get update && apt-get install -y build-essential make REDIS_CFLAGS='-Werror' - build-macos-latest: runs-on: macos-latest steps: @@ -44,7 +43,6 @@ jobs: run: | sudo apt-get update && sudo apt-get install libc6-dev-i386 make REDIS_CFLAGS='-Werror' 32bit - build-libc-malloc: runs-on: ubuntu-latest steps: @@ -61,3 +59,301 @@ jobs: run: | yum -y install gcc make make REDIS_CFLAGS='-Werror' + test-ubuntu-jemalloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make REDIS_CFLAGS='-Werror -DREDIS_TEST' + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + - name: unittest + run: ./src/redis-server test all + + test-ubuntu-libc-malloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make MALLOC=libc + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-ubuntu-no-malloc-usable-size: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make MALLOC=libc CFLAGS=-DNO_MALLOC_USABLE_SIZE + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-ubuntu-32bit: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + sudo apt-get update && sudo apt-get install libc6-dev-i386 + make 32bit REDIS_CFLAGS='-Werror -DREDIS_TEST' + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: | + make -C tests/modules 32bit + ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + - name: unittest + run: ./src/redis-server test all + + test-ubuntu-tls: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + make BUILD_TLS=yes + - name: testprep + run: | + sudo apt-get install tcl8.6 tclx tcl-tls + ./utils/gen-test-certs.sh + - name: test + run: | + ./runtest --accurate --verbose --tls --dump-logs + ./runtest --accurate --verbose --dump-logs + - name: module api test + run: | + ./runtest-moduleapi --verbose --tls + ./runtest-moduleapi --verbose + - name: sentinel tests + run: | + ./runtest-sentinel --tls + ./runtest-sentinel + - name: cluster tests + run: | + ./runtest-cluster --tls + ./runtest-cluster + + test-ubuntu-io-threads: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + make + - name: testprep + run: sudo apt-get install tcl8.6 tclx + - name: test + run: ./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network --dump-logs + - name: cluster tests + run: ./runtest-cluster --config io-threads 4 --config io-threads-do-reads yes + + test-valgrind: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make valgrind REDIS_CFLAGS='-Werror -DREDIS_TEST' + - name: testprep + run: | + sudo apt-get update + sudo apt-get install tcl8.6 tclx valgrind -y + - name: test + run: ./runtest --valgrind --verbose --clients 1 --tags -large-memory --dump-logs + - name: module api test + run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 + - name: unittest + run: | + valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all + if grep -q 0x err.txt; then cat err.txt; exit 1; fi + + test-valgrind-no-malloc-usable-size: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE" + - name: testprep + run: | + sudo apt-get update + sudo apt-get install tcl8.6 tclx valgrind -y + - name: test + run: ./runtest --valgrind --verbose --clients 1 --tags -large-memory --dump-logs + - name: module api test + run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 + + test-centos7-jemalloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + container: centos:7 + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + yum -y install gcc make + make + - name: testprep + run: yum -y install which tcl tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-centos7-tls: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + container: centos:7 + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: | + yum -y install centos-release-scl epel-release + yum -y install devtoolset-7 openssl-devel openssl + scl enable devtoolset-7 "make BUILD_TLS=yes" + - name: testprep + run: | + yum -y install tcl tcltls tclx + ./utils/gen-test-certs.sh + - name: test + run: | + ./runtest --accurate --verbose --tls --dump-logs + ./runtest --accurate --verbose --dump-logs + - name: module api test + run: | + ./runtest-moduleapi --verbose --tls + ./runtest-moduleapi --verbose + - name: sentinel tests + run: | + ./runtest-sentinel --tls + ./runtest-sentinel + - name: cluster tests + run: | + ./runtest-cluster --tls + ./runtest-cluster + test-macos-latest: + runs-on: macos-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: make + run: make + - name: test + run: ./runtest --accurate --verbose --no-latency --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-freebsd: + runs-on: macos-latest + if: github.repository == 'hwware/redis' + timeout-minutes: 14400 + steps: + - uses: actions/checkout@v2 + - name: test + uses: vmactions/freebsd-vm@v0.1.4 + with: + usesh: true + sync: rsync + prepare: pkg install -y bash gmake lang/tcl86 lang/tclx + run: > + gmake || exit 1 ; + if true ; then ./runtest --accurate --verbose --no-latency --tags -large-memory --dump-logs || exit 1 ; fi ; + if true ; then MAKE=gmake ./runtest-moduleapi --verbose || exit 1 ; fi ; + if true ; then ./runtest-sentinel || exit 1 ; fi ; + if true ; then ./runtest-cluster || exit 1 ; fi ; + test-alpine-jemalloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + container: alpine:latest + steps: + - uses: actions/checkout@v2 + - name: make + run: | + apk add build-base + make REDIS_CFLAGS='-Werror' + - name: testprep + run: apk add tcl procps tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster + + test-alpine-libc-malloc: + runs-on: ubuntu-latest + if: github.repository == 'hwware/redis' + container: alpine:latest + steps: + - uses: actions/checkout@v2 + - name: make + run: | + apk add build-base + make REDIS_CFLAGS='-Werror' USE_JEMALLOC=no CFLAGS=-DUSE_MALLOC_USABLE_SIZE + - name: testprep + run: apk add tcl procps tclx + - name: test + run: ./runtest --accurate --verbose --dump-logs + - name: module api test + run: ./runtest-moduleapi --verbose + - name: sentinel tests + run: ./runtest-sentinel + - name: cluster tests + run: ./runtest-cluster \ No newline at end of file diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index 2c72f85470b..e7e33a29a08 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -3,6 +3,14 @@ source "../tests/includes/init-tests.tcl" source "../../../tests/support/cli.tcl" +foreach_sentinel_id id { + S $id sentinel debug info-period 1000 + S $id sentinel debug ask-period 100 + S $id sentinel debug default-down-after 3000 + S $id sentinel debug publish-period 200 + S $id sentinel debug ping-period 100 +} + set ::alive_sentinel [expr {$::instances_count/2+2}] proc ensure_master_up {} { S $::alive_sentinel sentinel debug info-period 1000 @@ -69,7 +77,9 @@ test "SDOWN is triggered by misconfigured instance replying with errors" { R 0 config set dir / R 0 config set dbfilename tmp R 0 config set save "1000000 1000000" + after 5000 R 0 bgsave + after 5000 ensure_master_down R 0 config set save $orig_save R 0 config set dir $orig_dir From a4dddb5093ed2d001f56139dc436b96454516ae8 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 14:43:21 -0400 Subject: [PATCH 13/17] Update 07-down-conditions.tcl --- tests/sentinel/tests/07-down-conditions.tcl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index e7e33a29a08..92d95c3ab2c 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -13,10 +13,6 @@ foreach_sentinel_id id { set ::alive_sentinel [expr {$::instances_count/2+2}] proc ensure_master_up {} { - S $::alive_sentinel sentinel debug info-period 1000 - S $::alive_sentinel sentinel debug ping-period 100 - S $::alive_sentinel sentinel debug ask-period 100 - S $::alive_sentinel sentinel debug publish-period 100 wait_for_condition 1000 50 { [dict get [S $::alive_sentinel sentinel master mymaster] flags] eq "master" } else { @@ -24,12 +20,7 @@ proc ensure_master_up {} { } } - proc ensure_master_down {} { - S $::alive_sentinel sentinel debug info-period 1000 - S $::alive_sentinel sentinel debug ping-period 100 - S $::alive_sentinel sentinel debug ask-period 100 - S $::alive_sentinel sentinel debug publish-period 100 wait_for_condition 1000 50 { [string match *down* \ [dict get [S $::alive_sentinel sentinel master mymaster] flags]] From 29f22b598fa030e581676616783582e92e3cf54c Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 13 Sep 2021 18:53:00 -0400 Subject: [PATCH 14/17] Update 02-slaves-reconf.tcl --- tests/sentinel/tests/02-slaves-reconf.tcl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/sentinel/tests/02-slaves-reconf.tcl b/tests/sentinel/tests/02-slaves-reconf.tcl index 8196b60fac3..330f68b050c 100644 --- a/tests/sentinel/tests/02-slaves-reconf.tcl +++ b/tests/sentinel/tests/02-slaves-reconf.tcl @@ -7,6 +7,14 @@ source "../tests/includes/init-tests.tcl" +foreach_sentinel_id id { + S $id sentinel debug info-period 1000 + S $id sentinel debug ask-period 100 + S $id sentinel debug default-down-after 3000 + S $id sentinel debug publish-period 200 + S $id sentinel debug ping-period 100 +} + proc 02_test_slaves_replication {} { uplevel 1 { test "Check that slaves replicate from current master" { From db687c34ab3edfe0027ea561be405687239eb8e7 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Tue, 14 Sep 2021 08:49:04 -0400 Subject: [PATCH 15/17] Update 02-slaves-reconf.tcl --- tests/sentinel/tests/02-slaves-reconf.tcl | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/sentinel/tests/02-slaves-reconf.tcl b/tests/sentinel/tests/02-slaves-reconf.tcl index 330f68b050c..329c1a01575 100644 --- a/tests/sentinel/tests/02-slaves-reconf.tcl +++ b/tests/sentinel/tests/02-slaves-reconf.tcl @@ -7,14 +7,6 @@ source "../tests/includes/init-tests.tcl" -foreach_sentinel_id id { - S $id sentinel debug info-period 1000 - S $id sentinel debug ask-period 100 - S $id sentinel debug default-down-after 3000 - S $id sentinel debug publish-period 200 - S $id sentinel debug ping-period 100 -} - proc 02_test_slaves_replication {} { uplevel 1 { test "Check that slaves replicate from current master" { @@ -57,12 +49,6 @@ proc 02_crash_and_failover {} { 02_test_slaves_replication 02_crash_and_failover -foreach_sentinel_id id { - S $id sentinel debug info-period 100 - S $id sentinel debug default-down-after 1000 - S $id sentinel debug publish-period 100 -} - 02_test_slaves_replication test "Kill a slave instance" { From b024e68bb466acef7ca587e0e4c9c4b5ac733f46 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Tue, 14 Sep 2021 09:30:35 -0400 Subject: [PATCH 16/17] Update 00-base.tcl --- tests/sentinel/tests/00-base.tcl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/sentinel/tests/00-base.tcl b/tests/sentinel/tests/00-base.tcl index f00efc61e37..bb1c6c0e808 100644 --- a/tests/sentinel/tests/00-base.tcl +++ b/tests/sentinel/tests/00-base.tcl @@ -18,9 +18,9 @@ test "Basic failover works if the master is down" { assert {[lindex $addr 1] == $old_port} kill_instance redis $master_id foreach_sentinel_id id { - S $id sentinel debug ping-period 100 - S $id sentinel debug ask-period 100 - wait_for_condition 1000 50 { + S $id sentinel debug ping-period 500 + S $id sentinel debug ask-period 500 + wait_for_condition 1000 100 { [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port } else { fail "At least one Sentinel did not receive failover info" @@ -101,7 +101,7 @@ test "Failover works if we configure for absolute agreement" { # Wait for Sentinels to monitor the master again foreach_sentinel_id id { - wait_for_condition 1000 50 { + wait_for_condition 1000 100 { [dict get [S $id SENTINEL MASTER mymaster] info-refresh] < 100000 } else { fail "At least one Sentinel is not monitoring the master" @@ -111,7 +111,7 @@ test "Failover works if we configure for absolute agreement" { kill_instance redis $master_id foreach_sentinel_id id { - wait_for_condition 1000 50 { + wait_for_condition 1000 100 { [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port } else { fail "At least one Sentinel did not receive failover info" From c293d6ebbeb3ac87d3382015a431250a9708fba5 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Tue, 14 Sep 2021 10:31:35 -0400 Subject: [PATCH 17/17] Update 00-base.tcl --- tests/sentinel/tests/00-base.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sentinel/tests/00-base.tcl b/tests/sentinel/tests/00-base.tcl index bb1c6c0e808..7b4d49b57e5 100644 --- a/tests/sentinel/tests/00-base.tcl +++ b/tests/sentinel/tests/00-base.tcl @@ -20,6 +20,7 @@ test "Basic failover works if the master is down" { foreach_sentinel_id id { S $id sentinel debug ping-period 500 S $id sentinel debug ask-period 500 + wait_for_condition 1000 100 { [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port } else {