Skip to content

Commit

Permalink
Refactor some tests to reference new executable
Browse files Browse the repository at this point in the history
  • Loading branch information
madolson committed Mar 22, 2024
1 parent 0aaae73 commit ee10748
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tests/support/server.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ proc create_server_config_file {filename config config_lines} {
}

proc spawn_server {config_file stdout stderr args} {
set cmd [list src/redis-server $config_file]
set cmd [list src/placeholderkv-server $config_file]
set args {*}$args
if {[llength $args] > 0} {
lappend cmd {*}$args
Expand Down
2 changes: 1 addition & 1 deletion tests/support/util.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ proc system_backtrace_supported {} {
# libmusl does not support backtrace. Also return 0 on
# static binaries (ldd exit code 1) where we can't detect libmusl
catch {
set ldd [exec ldd src/redis-server]
set ldd [exec ldd src/placeholderkv-server]
if {![string match {*libc.*musl*} $ldd]} {
return 1
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/acl.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1227,10 +1227,10 @@ start_server [list overrides [list "dir" $server_path "aclfile" "user.acl"] tags
}

test {Test loading duplicate users in config on startup} {
catch {exec src/redis-server --user foo --user foo} err
catch {exec src/placeholderkv-server --user foo --user foo} err
assert_match {*Duplicate user*} $err

catch {exec src/redis-server --user default --user default} err
catch {exec src/placeholderkv-server --user default --user default} err
assert_match {*Duplicate user*} $err
} {} {external:skip}
}
Expand Down
24 changes: 12 additions & 12 deletions tests/unit/introspection.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -708,44 +708,44 @@ start_server {tags {"introspection"}} {

test {redis-server command line arguments - error cases} {
# Take '--invalid' as the option.
catch {exec src/redis-server --invalid} err
catch {exec src/placeholderkv-server --invalid} err
assert_match {*Bad directive or wrong number of arguments*} $err

catch {exec src/redis-server --port} err
catch {exec src/placeholderkv-server --port} err
assert_match {*'port'*wrong number of arguments*} $err

catch {exec src/redis-server --port 6380 --loglevel} err
catch {exec src/placeholderkv-server --port 6380 --loglevel} err
assert_match {*'loglevel'*wrong number of arguments*} $err

# Take `6379` and `6380` as the port option value.
catch {exec src/redis-server --port 6379 6380} err
catch {exec src/placeholderkv-server --port 6379 6380} err
assert_match {*'port "6379" "6380"'*wrong number of arguments*} $err

# Take `--loglevel` and `verbose` as the port option value.
catch {exec src/redis-server --port --loglevel verbose} err
catch {exec src/placeholderkv-server --port --loglevel verbose} err
assert_match {*'port "--loglevel" "verbose"'*wrong number of arguments*} $err

# Take `--bla` as the port option value.
catch {exec src/redis-server --port --bla --loglevel verbose} err
catch {exec src/placeholderkv-server --port --bla --loglevel verbose} err
assert_match {*'port "--bla"'*argument couldn't be parsed into an integer*} $err

# Take `--bla` as the loglevel option value.
catch {exec src/redis-server --logfile --my--log--file --loglevel --bla} err
catch {exec src/placeholderkv-server --logfile --my--log--file --loglevel --bla} err
assert_match {*'loglevel "--bla"'*argument(s) must be one of the following*} $err

# Using MULTI_ARG's own check, empty option value
catch {exec src/redis-server --shutdown-on-sigint} err
catch {exec src/placeholderkv-server --shutdown-on-sigint} err
assert_match {*'shutdown-on-sigint'*argument(s) must be one of the following*} $err
catch {exec src/redis-server --shutdown-on-sigint "now force" --shutdown-on-sigterm} err
catch {exec src/placeholderkv-server --shutdown-on-sigint "now force" --shutdown-on-sigterm} err
assert_match {*'shutdown-on-sigterm'*argument(s) must be one of the following*} $err

# Something like `redis-server --some-config --config-value1 --config-value2 --loglevel debug` would break,
# because if you want to pass a value to a config starting with `--`, it can only be a single value.
catch {exec src/redis-server --replicaof 127.0.0.1 abc} err
catch {exec src/placeholderkv-server --replicaof 127.0.0.1 abc} err
assert_match {*'replicaof "127.0.0.1" "abc"'*Invalid master port*} $err
catch {exec src/redis-server --replicaof --127.0.0.1 abc} err
catch {exec src/placeholderkv-server --replicaof --127.0.0.1 abc} err
assert_match {*'replicaof "--127.0.0.1" "abc"'*Invalid master port*} $err
catch {exec src/redis-server --replicaof --127.0.0.1 --abc} err
catch {exec src/placeholderkv-server --replicaof --127.0.0.1 --abc} err
assert_match {*'replicaof "--127.0.0.1"'*wrong number of arguments*} $err
} {} {external:skip}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/moduleapi/moduleconfigs.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ start_server {tags {"modules"}} {
}
test {startup moduleconfigs} {
# No loadmodule directive
catch {exec src/redis-server --moduleconfigs.string "hello"} err
catch {exec src/placeholderkv-server --moduleconfigs.string "hello"} err
assert_match {*Module Configuration detected without loadmodule directive or no ApplyConfig call: aborting*} $err

# Bad config value
catch {exec src/redis-server --loadmodule "$testmodule" --moduleconfigs.string "rejectisfreed"} err
catch {exec src/placeholderkv-server --loadmodule "$testmodule" --moduleconfigs.string "rejectisfreed"} err
assert_match {*Issue during loading of configuration moduleconfigs.string : Cannot set string to 'rejectisfreed'*} $err

# missing LoadConfigs call
catch {exec src/redis-server --loadmodule "$testmodule" noload --moduleconfigs.string "hello"} err
catch {exec src/placeholderkv-server --loadmodule "$testmodule" noload --moduleconfigs.string "hello"} err
assert_match {*Module Configurations were not set, likely a missing LoadConfigs call. Unloading the module.*} $err

# successful
Expand Down

0 comments on commit ee10748

Please sign in to comment.