Skip to main content

license PyPI version CI Version Codecov Known Vulnerabilities

RLTest

Redis Labs Test Framework, allow running tests on redis and modules on a variety of environments.

Supported Environment: oss, oss-cluster, enterprise, enterprise-cluster

The framework allow you to write a test without environment specification and then run the test on all supported environment.

Install

$ pip install git+https://github.com/RedisLabsModules/RLTest.git@master

Usage:

$ RLTest --help
usage: RLTest [-h] [--version] [--module MODULE] [--module-args MODULE_ARGS]
              [--env {oss,oss-cluster,enterprise,enterprise-cluster,existing-env,cluster_existing-env}]
              [--existing-env-addr EXISTING_ENV_ADDR]
              [--shards_ports SHARDS_PORTS]
              [--cluster_address CLUSTER_ADDRESS]
              [--oss_password OSS_PASSWORD]
              [--cluster_credentials CLUSTER_CREDENTIALS]
              [--cluster_node_timeout CLUSTER_NODE_TIMEOUT]
              [--internal_password INTERNAL_PASSWORD]
              [--oss-redis-path OSS_REDIS_PATH]
              [--enterprise-redis-path ENTERPRISE_REDIS_PATH]
              [--stop-on-failure] [-x] [--verbose] [--debug] [-t TEST]
              [--env-only] [--clear-logs] [--log-dir LOG_DIR] [--use-slaves]
              [--shards-count SHARDS_COUNT] [--download-enterprise-binaries]
              [--proxy-binary-path PROXY_BINARY_PATH]
              [--enterprise-lib-path ENTERPRISE_LIB_PATH] [-r]
              [--use-aof] [--use-rdb-preamble]
              [--debug-print] [-V] [--vg-suppressions VG_SUPPRESSIONS]
              [--vg-options VG_OPTIONS] [--vg-no-leakcheck] [--vg-verbose]
              [--vg-no-fail-on-errors] [-i] [--debugger DEBUGGER] [-s]
              [--check-exitcode] [--unix] [--randomize-ports] [--collect-only]
              [--tls] [--tls-cert-file TLS_CERT_FILE]
              [--tls-key-file TLS_KEY_FILE]
              [--tls-ca-cert-file TLS_CA_CERT_FILE]

Test Framework for redis and redis module

optional arguments:
  -h, --help            show this help message and exit
  --version             Print RLTest version and exit (default: False)
  --module MODULE       path to the module file. You can use `--module` more
                        than once but it imples that you explicitly specify
                        `--module-args` as well. Notice that on enterprise the
                        file should be a zip file packed with
                        [RAMP](https://github.com/RedisLabs/RAMP). (default:
                        None)
  --module-args MODULE_ARGS
                        arguments to give to the module on loading (default:
                        None)
  --env {oss,oss-cluster,enterprise,enterprise-cluster,existing-env,cluster_existing-env}, -e {oss,oss-cluster,enterprise,enterprise-cluster,existing-env,cluster_existing-env}
                        env on which to run the test (default: oss)
  --existing-env-addr EXISTING_ENV_ADDR
                        Address of existing env, relevent only when running
                        with existing-env, cluster_existing-env (default:
                        localhost:6379)
  --shards_ports SHARDS_PORTS
                        list of ports, the shards are listening to, relevent
                        only when running with cluster_existing-env (default:
                        None)
  --cluster_address CLUSTER_ADDRESS
                        enterprise cluster ip, relevent only when running with
                        cluster_existing-env (default: None)
  --oss_password OSS_PASSWORD
                        set redis password, relevant for oss and oss-cluster
                        environment (default: None)
  --cluster_credentials CLUSTER_CREDENTIALS
                        enterprise cluster cluster_credentials
                        "username:password", relevent only when running with
                        cluster_existing-env (default: None)
  --cluster_node_timeout CLUSTER_NODE_TIMEOUT
                        cluster node timeout in milliseconds
  --internal_password INTERNAL_PASSWORD
                        Give an ability to execute commands on shards
                        directly, relevent only when running with
                        cluster_existing-env (default: )
  --oss-redis-path OSS_REDIS_PATH
                        path to the oss redis binary (default: redis-server)
  --enterprise-redis-path ENTERPRISE_REDIS_PATH
                        path to the enterprise redis binary (default:
                        ~/.RLTest/opt/redislabs/bin/redis-server)
  --redis-config-file REDIS_CONFIG_FILE
                        path to the redis configuration file (default: None)
  --stop-on-failure     stop running on failure (default: False)
  -x, --exit-on-failure
                        Stop test execution and exit on first assertion
                        failure (default: False)
  --verbose, -v         print more information about the test (default: 0)
  --debug               stop before each test allow gdb attachment (default:
                        False)
  -t TEST, --test TEST  Specify test to run, in the form of "file:test"
                        (default: None)
  --env-only            start the env but do not run any tests (default:
                        False)
  --clear-logs          deleting the log direcotry before the execution
                        (default: False)
  --log-dir LOG_DIR     directory to write logs to (default: ./logs)
  --use-slaves          run env with slaves enabled (default: False)
  --shards-count SHARDS_COUNT
                        Number shards in bdb (default: 1)
  --download-enterprise-binaries
                        run env with slaves enabled (default: False)
  --proxy-binary-path PROXY_BINARY_PATH
                        dmc proxy binary path (default:
                        ~/.RLTest/opt/redislabs/bin/dmcproxy)
  --enterprise-lib-path ENTERPRISE_LIB_PATH
                        path of needed libraries to run enterprise binaries
                        (default: ~/.RLTest/opt/redislabs/lib/)
  -r, --env-reuse       reuse exists env, this feature is based on best
                        efforts, if the env can not be reused then it will be
                        taken down. (default: False)
  --use-aof             use aof instead of rdb (default: False)
  --use-rdb-preamble    use rdb preamble when rewriting aof file (default: True)
  --debug-print         print debug messages (default: False)
  -V, --vg, --use-valgrind
                        running redis under valgrind (assuming valgrind is
                        install on the machine) (default: False)
  --vg-suppressions VG_SUPPRESSIONS
                        path valgrind suppressions file (default: None)
  --vg-options VG_OPTIONS
                        valgrind [options] (default: None)
  --vg-no-leakcheck     Don't perform a leak check (default: False)
  --vg-verbose          Don't log valgrind output. Output to screen directly
                        (default: False)
  --vg-no-fail-on-errors
                        Dont Fail test when valgrind reported any errors in
                        the run.By default on RLTest the return value from
                        Valgrind will be used to fail the tests.Use this
                        option when you wish to dry-run valgrind but not fail
                        the test on valgrind reported errors. (default: False)
  -i, --interactive-debugger
                        runs the redis on a debuger (gdb/lldb)
                        interactivly.debugger interactive mode is only
                        possible on a single process and so unsupported on
                        cluste or with slaves.it is also not possible to use
                        valgrind on interactive mode.interactive mode direcly
                        applies: --no-output-catch and --stop-on-failure.it is
                        also implies that only one test will be run (if --env-
                        only was not specify), an error will be raise
                        otherwise. (default: False)
  --debugger DEBUGGER   Run specified command line as the debugger (default:
                        None)
  -s, --no-output-catch
                        all output will be written to the stdout, no log
                        files. (default: False)
  --check-exitcode      Check redis process exit code (default: False)
  --unix                Use Unix domain sockets instead of TCP (default:
                        False)
  --randomize-ports     Randomize Redis listening port assignment rather
                        than using default port (default: False)
  --collect-only        Collect the tests and exit (default: False)
  --tls                 Enable TLS Support and disable the non-TLS port
                        completely. TLS connections will be available at the
                        default non-TLS ports. (default: False)
  --tls-cert-file TLS_CERT_FILE
                        /path/to/redis.crt (default: None)
  --tls-key-file TLS_KEY_FILE
                        /path/to/redis.key (default: None)
  --tls-ca-cert-file TLS_CA_CERT_FILE
                        /path/to/ca.crt (default: None)

  --dualTLS             Initialize both TLS and non-TLS ports for all shards.
                        The non-TLS ports will be the TLS ports + 1500.
                        Only effective when TLS is active (see `useTLS`).

Sample usages

Multiple modules

RLTest --module modules/module1.so --module-args '' --module modules/module2.so --module-args ''

Configuration File

By default, the framework search for configuration file on the current directory. The configuration file name is: config.txt. It is possible to specify different configuration file on command line using the '@' prefix, for example:

RLTest @myConfig.txt # search for myConfig.txt configuration file

The configuration file format is the same as the command line argument, i.e : '--< param_name > < param_val >'.

It is also possible to comment a specific lines in the configuration file using '#'.

Example:

-vv
--clear-logs
#--debug

Test Example

from RLTest import Env
import time


class testExample():
    '''
    run all tests on a single env without taking
    env down between tests
    '''
    def __init__(self):
        self.env = Env()

    def testExample(self):
        con = self.env.getConnection()
        con.set('x', 1)
        self.env.assertEqual(con.get('x'), '1')

    def testExample1(self):
        con = self.env.getConnection()
        con.set('x', 1)
        self.env.assertEqual(con.get('x'), '1')
        self.env.assertFalse(True)  # check failure

    def testExample2(self):
        con = self.env.getConnection()
        con.set('x', 1)
        self.env.assertEqual(con.get('x'), '1')


# run each test on different env
def test_example():
    env = Env()
    con = env.getConnection()
    con.set('x', 1)
    env.assertEqual(con.get('x'), '1')


def test_example_2():
    env = Env()
    env.assertOk(env.cmd('set', 'x', '1'))
    env.expect('get', 'x').equal('1')

    env.expect('lpush', 'list', '1', '2', '3').equal(3)
    env.expect('lrange', 'list', '0', '-1').debugPrint().contains('1')
    env.debugPrint('this is some debug printing')


def test_example_3():
    env = Env(useSlaves=True, env='oss')
    con = env.getConnection()
    con.set('x', 1)
    con2 = env.getSlaveConnection()
    time.sleep(0.1)
    env.assertEqual(con2.get('x'), '1')

Shutdown grace period

With the default shutdown policy (terminateRetries=None), RLTest retries SIGTERM once per second for up to 30 seconds, then sends SIGKILL and waits up to 5 seconds for process exit. Valgrind and sanitizer runs get a 300-second grace period to allow for slower saves and exit-time analysis. Explicit terminateRetries/terminateRetrySecs settings retain their existing behavior. A forced shutdown under the default policy fails the test even without --check-exitcode.

On macOS, interactive debugger teardown also bounds the inferior-process wait: 30 seconds after SIGTERM, followed by SIGKILL and a 5-second wait. An inferior left paused at a breakpoint can therefore be killed and reported as a failure; teardown no longer waits indefinitely for debugger input.

Metadata

Release files for RLTest 0.7.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RLTest 0.7.32
File Size Uploaded Provenance Actions
rltest-0.7.32.tar.gz 48.5 kB Without provenance Details for rltest-0.7.32.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for RLTest 0.7.32
File Interpreter ABI Platform Actions
rltest-0.7.32-py3-none-any.whl Python 3 none any Details for rltest-0.7.32-py3-none-any.whl

Total release size: 102.1 kB

Release files / rltest-0.7.32.tar.gz

Download URL rltest-0.7.32.tar.gz
Size 48.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bde5ccde4e9a28e562789c75804f217f7dba522b1edcb9bf304be7a38bbb8e19
BLAKE2b-256 checksum
How to use checksums
002dbfccaa73f306eade9fcc5301db86afffb9e620f4bf1a857f7f44ce69cece
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.3 Linux/6.17.0-1022-azure

Release files / rltest-0.7.32-py3-none-any.whl

Download URL rltest-0.7.32-py3-none-any.whl
Size 53.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
342b1c53814f292df942e7ee4b56413dbea61adf4a5f0bf716ea7604b52bdcbd
BLAKE2b-256 checksum
How to use checksums
b5a31d8ed4f617d75b62d91e592dcd9d28127edbe82851f3942f19f29939658e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.3 Linux/6.17.0-1022-azure

Security for RLTest 0.7.32

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.7.32 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page