Unverified Commit 522d9360 authored by Yossi Gottlieb's avatar Yossi Gottlieb Committed by GitHub
Browse files

Add io-thread daily CI tests. (#8232)

This adds basic coverage to IO threads by running the cluster and few selected Redis test suite tests with the IO threads enabled.

Also provides some necessary additional improvements to the test suite:

* Add --config to sentinel/cluster tests for arbitrary configuration.
* Fix --tags whitelisting which was broken.
* Add a `network` tag to some tests that are more network intensive. This is work in progress and more tests should be properly tagged in the future.
parent f5cf1e46
...@@ -99,6 +99,23 @@ jobs: ...@@ -99,6 +99,23 @@ jobs:
./runtest-cluster --tls ./runtest-cluster --tls
./runtest-cluster ./runtest-cluster
test-ubuntu-io-threads:
runs-on: ubuntu-latest
if: github.repository == 'redis/redis'
timeout-minutes: 14400
steps:
- uses: actions/checkout@v2
- name: make
run: |
make
- name: test
run: |
sudo apt-get install tcl8.5 tcl-tls
./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network
- name: cluster tests
run: |
./runtest-cluster --config io-threads 4 --config io-threads-do-reads yes
test-valgrind: test-valgrind:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'redis/redis' if: github.repository == 'redis/redis'
......
...@@ -24,6 +24,7 @@ set ::simulate_error 0 ...@@ -24,6 +24,7 @@ set ::simulate_error 0
set ::failed 0 set ::failed 0
set ::sentinel_instances {} set ::sentinel_instances {}
set ::redis_instances {} set ::redis_instances {}
set ::global_config {}
set ::sentinel_base_port 20000 set ::sentinel_base_port 20000
set ::redis_base_port 30000 set ::redis_base_port 30000
set ::redis_port_count 1024 set ::redis_port_count 1024
...@@ -92,6 +93,9 @@ proc spawn_instance {type base_port count {conf {}}} { ...@@ -92,6 +93,9 @@ proc spawn_instance {type base_port count {conf {}}} {
foreach directive $conf { foreach directive $conf {
puts $cfg $directive puts $cfg $directive
} }
dict for {name val} $::global_config {
puts $cfg "$name $val"
}
close $cfg close $cfg
# Finally exec it and remember the pid for later cleanup. # Finally exec it and remember the pid for later cleanup.
...@@ -239,6 +243,10 @@ proc parse_options {} { ...@@ -239,6 +243,10 @@ proc parse_options {} {
-certfile "$::tlsdir/client.crt" \ -certfile "$::tlsdir/client.crt" \
-keyfile "$::tlsdir/client.key" -keyfile "$::tlsdir/client.key"
set ::tls 1 set ::tls 1
} elseif {$opt eq {--config}} {
set val2 [lindex $::argv [expr $j+2]]
dict set ::global_config $val $val2
incr j 2
} elseif {$opt eq "--help"} { } elseif {$opt eq "--help"} {
puts "--single <pattern> Only runs tests specified by pattern." puts "--single <pattern> Only runs tests specified by pattern."
puts "--dont-clean Keep log files on exit." puts "--dont-clean Keep log files on exit."
...@@ -246,6 +254,7 @@ proc parse_options {} { ...@@ -246,6 +254,7 @@ proc parse_options {} {
puts "--fail Simulate a test failure." puts "--fail Simulate a test failure."
puts "--valgrind Run with valgrind." puts "--valgrind Run with valgrind."
puts "--tls Run tests in TLS mode." puts "--tls Run tests in TLS mode."
puts "--config <k> <v> Extra config argument(s)."
puts "--help Shows this help." puts "--help Shows this help."
exit 0 exit 0
} else { } else {
......
tags {"rdb"} {
set server_path [tmpdir "server.rdb-encoding-test"] set server_path [tmpdir "server.rdb-encoding-test"]
# Copy RDB with different encodings in server path # Copy RDB with different encodings in server path
...@@ -289,3 +291,5 @@ start_server {overrides {save ""}} { ...@@ -289,3 +291,5 @@ start_server {overrides {save ""}} {
} }
} }
} ;# system_name } ;# system_name
} ;# tags
...@@ -5,7 +5,7 @@ proc cmdstat {cmd} { ...@@ -5,7 +5,7 @@ proc cmdstat {cmd} {
return [cmdrstat $cmd r] return [cmdrstat $cmd r]
} }
start_server {tags {"benchmark"}} { start_server {tags {"benchmark network"}} {
start_server {} { start_server {} {
set master_host [srv 0 host] set master_host [srv 0 host]
set master_port [srv 0 port] set master_port [srv 0 port]
......
start_server {tags {"repl"}} { start_server {tags {"repl network"}} {
start_server {} { start_server {} {
set master [srv -1 client] set master [srv -1 client]
......
...@@ -5,7 +5,7 @@ proc log_file_matches {log pattern} { ...@@ -5,7 +5,7 @@ proc log_file_matches {log pattern} {
string match $pattern $content string match $pattern $content
} }
start_server {tags {"repl"}} { start_server {tags {"repl network"}} {
set slave [srv 0 client] set slave [srv 0 client]
set slave_host [srv 0 host] set slave_host [srv 0 host]
set slave_port [srv 0 port] set slave_port [srv 0 port]
......
...@@ -152,20 +152,48 @@ proc server_is_up {host port retrynum} { ...@@ -152,20 +152,48 @@ proc server_is_up {host port retrynum} {
return 0 return 0
} }
# Check if current ::tags match requested tags. If ::allowtags are used,
# there must be some intersection. If ::denytags are used, no intersection
# is allowed. Returns 1 if tags are acceptable or 0 otherwise, in which
# case err_return names a return variable for the message to be logged.
proc tags_acceptable {err_return} {
upvar $err_return err
# If tags are whitelisted, make sure there's match
if {[llength $::allowtags] > 0} {
set matched 0
foreach tag $::allowtags {
if {[lsearch $::tags $tag] >= 0} {
incr matched
}
}
if {$matched < 1} {
set err "Tag: none of the tags allowed"
return 0
}
}
foreach tag $::denytags {
if {[lsearch $::tags $tag] >= 0} {
set err "Tag: $tag denied"
return 0
}
}
return 1
}
# doesn't really belong here, but highly coupled to code in start_server # doesn't really belong here, but highly coupled to code in start_server
proc tags {tags code} { proc tags {tags code} {
# If we 'tags' contain multiple tags, quoted and seperated by spaces, # If we 'tags' contain multiple tags, quoted and seperated by spaces,
# we want to get rid of the quotes in order to have a proper list # we want to get rid of the quotes in order to have a proper list
set tags [string map { \" "" } $tags] set tags [string map { \" "" } $tags]
set ::tags [concat $::tags $tags] set ::tags [concat $::tags $tags]
# We skip unwanted tags if {![tags_acceptable err]} {
foreach tag $::denytags { incr ::num_aborted
if {[lsearch $::tags $tag] >= 0} { send_data_packet $::test_server_fd ignore $err
incr ::num_aborted set ::tags [lrange $::tags 0 end-[llength $tags]]
send_data_packet $::test_server_fd ignore "Tag: $tag" return
set ::tags [lrange $::tags 0 end-[llength $tags]]
return
}
} }
uplevel 1 $code uplevel 1 $code
set ::tags [lrange $::tags 0 end-[llength $tags]] set ::tags [lrange $::tags 0 end-[llength $tags]]
...@@ -267,13 +295,11 @@ proc start_server {options {code undefined}} { ...@@ -267,13 +295,11 @@ proc start_server {options {code undefined}} {
} }
# We skip unwanted tags # We skip unwanted tags
foreach tag $::denytags { if {![tags_acceptable err]} {
if {[lsearch $::tags $tag] >= 0} { incr ::num_aborted
incr ::num_aborted send_data_packet $::test_server_fd ignore $err
send_data_packet $::test_server_fd ignore "Tag: $tag" set ::tags [lrange $::tags 0 end-[llength $tags]]
set ::tags [lrange $::tags 0 end-[llength $tags]] return
return
}
} }
# If we are running against an external server, we just push the # If we are running against an external server, we just push the
......
start_server {tags {"limits"} overrides {maxclients 10}} { start_server {tags {"limits network"} overrides {maxclients 10}} {
if {$::tls} { if {$::tls} {
set expected_code "*I/O error*" set expected_code "*I/O error*"
} else { } else {
......
start_server {tags {"pause"}} { start_server {tags {"pause network"}} {
test "Test read commands are not blocked by client pause" { test "Test read commands are not blocked by client pause" {
r client PAUSE 100000000 WRITE r client PAUSE 100000000 WRITE
set rd [redis_deferring_client] set rd [redis_deferring_client]
......
start_server {tags {"protocol"}} { start_server {tags {"protocol network"}} {
test "Handle an empty query" { test "Handle an empty query" {
reconnect reconnect
r write "\r\n" r write "\r\n"
......
start_server {tags {"pubsub"}} { start_server {tags {"pubsub network"}} {
proc __consume_subscribe_messages {client type channels} { proc __consume_subscribe_messages {client type channels} {
set numsub -1 set numsub -1
set counts {} set counts {}
......
start_server {tags {"scan"}} { start_server {tags {"scan network"}} {
test "SCAN basic" { test "SCAN basic" {
r flushdb r flushdb
r debug populate 1000 r debug populate 1000
......
start_server {tags {"tracking"}} { start_server {tags {"tracking network"}} {
# Create a deferred client we'll use to redirect invalidation # Create a deferred client we'll use to redirect invalidation
# messages to. # messages to.
set rd_redirection [redis_deferring_client] set rd_redirection [redis_deferring_client]
......
source tests/support/cli.tcl source tests/support/cli.tcl
start_server {tags {"wait"}} { start_server {tags {"wait network"}} {
start_server {} { start_server {} {
set slave [srv 0 client] set slave [srv 0 client]
set slave_host [srv 0 host] set slave_host [srv 0 host]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment