Fix CONFIG SET test failures in MacOS/FreeBSD (#9881)

After the introduction of `Multiparam config set` in #9748,
there are two tests cases failed.

```
[exception]: Executing test client: ERR Config set failed - Failed to set current oom_score_adj. Check server logs..
ERR Config set failed - Failed to set current oom_score_adj. Check server logs.
```

`CONFIG sanity` test failed on the `config set oom-score-adj-values`
which is a "special" config that does not catch no-op changes.
And then it will update `oom-score-adj` which not supported in
MacOs. We solve it by adding `oom-score*` to the `skip_configs` list.

```
*** [err]: CONFIG SET rollback on apply error in tests/unit/introspection.tcl
Expected an error but nothing was caught
```

`CONFIG SET rollback on apply error` test failed on the
`config set port $used_port`. In theory, it should throw the
error `Unable to listen on this port*`. But it failed on MacOs.
We solve it by adding `-myaddr 127.0.0.1` to the socket call.
This commit is contained in:
Binbin 2021-12-03 00:18:18 +08:00 committed by GitHub
parent e3c0ea1cb4
commit e57a4db5d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,6 +199,8 @@ start_server {tags {"introspection"}} {
set-proc-title set-proc-title
cluster-config-file cluster-config-file
cluster-port cluster-port
oom-score-adj
oom-score-adj-values
} }
if {!$::tls} { if {!$::tls} {
@ -362,20 +364,21 @@ start_server {tags {"introspection"}} {
lappend backups $c [lindex [r config get $c] 1] lappend backups $c [lindex [r config get $c] 1]
} }
set used_port [find_available_port $::baseport $::portcount]
set used_port [expr ([dict get $backups port]+1)%65536]
dict set some_configs port $used_port dict set some_configs port $used_port
# Run a dummy server on used_port so we know we can't configure redis to # Run a dummy server on used_port so we know we can't configure redis to
# use it. It's ok for this to fail because that means used_port is invalid # use it. It's ok for this to fail because that means used_port is invalid
# anyway # anyway
catch {socket -server dummy_accept $used_port} catch {socket -server dummy_accept -myaddr 127.0.0.1 $used_port} e
if {$::verbose} { puts "dummy_accept: $e" }
# Try to listen on the used port, pass some more configs to make sure the # Try to listen on the used port, pass some more configs to make sure the
# returned failure message is for the first bad config and everything is rolled back. # returned failure message is for the first bad config and everything is rolled back.
assert_error "ERR Config set failed - Unable to listen on this port*" { assert_error "ERR Config set failed - Unable to listen on this port*" {
eval "r config set $some_configs" eval "r config set $some_configs"
} }
# Make sure we reverted back to previous configs # Make sure we reverted back to previous configs
dict for {conf val} $backups { dict for {conf val} $backups {
assert_equal [lindex [r config get $conf] 1] $val assert_equal [lindex [r config get $conf] 1] $val