summaryrefslogtreecommitdiff
path: root/tests/support/benchmark.tcl
blob: 156b20556e3228ef43fd57bbc0162ecad38fb6e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
proc redisbenchmark_tls_config {testsdir} {
    set tlsdir [file join $testsdir tls]
    set cert [file join $tlsdir client.crt]
    set key [file join $tlsdir client.key]
    set cacert [file join $tlsdir ca.crt]

    if {$::tls} {
        return [list --tls --cert $cert --key $key --cacert $cacert]
    } else {
        return {}
    }
}

proc redisbenchmark {host port {opts {}}} {
    set cmd [list src/redis-benchmark -h $host -p $port]
    lappend cmd {*}[redisbenchmark_tls_config "tests"]
    lappend cmd {*}$opts
    return $cmd
}

proc redisbenchmarkuri {host port {opts {}}} {
    set cmd [list src/redis-benchmark -u redis://$host:$port]
    lappend cmd {*}[redisbenchmark_tls_config "tests"]
    lappend cmd {*}$opts
    return $cmd
}

proc redisbenchmarkuriuserpass {host port user pass {opts {}}} {
    set cmd [list src/redis-benchmark -u redis://$user:$pass@$host:$port]
    lappend cmd {*}[redisbenchmark_tls_config "tests"]
    lappend cmd {*}$opts
    return $cmd
}