Class luatest.cbuilder
Configuration builder.
It allows to construct a declarative configuration for a test case using less boilerplace code/options, especially when a replicaset is to be tested, not a single instance. All the methods support chaining (return the builder object back).
local config = Builder:new()
:add_instance('instance-001', {
database = {
mode = 'rw',
},
})
:add_instance('instance-002', {})
:add_instance('instance-003', {})
:config()
By default, all instances are added to replicaset-001 in group-001,
but it's possible to select a different replicaset and/or group:
local config = Builder:new()
:use_group('group-001')
:use_replicaset('replicaset-001')
:add_instance(<...>)
:add_instance(<...>)
:add_instance(<...>)
:use_group('group-002')
:use_replicaset('replicaset-002')
:add_instance(<...>)
:add_instance(<...>)
:add_instance(<...>)
:config()
The default credentials and iproto options are added to
setup replication and to allow a test to connect to the
instances.
There is a few other methods:
* :set_replicaset_option('foo.bar', value)
* :set_instance_option('instance-001', 'foo.bar', value)
Add an instance with the given options to the selected replicaset.
Parameters:
- instance_name: (string) Instance where the config will be saved.
- iconfig: (tab) Declarative config for the instance.
Build a config builder object.
Parameters:
- config: (tab) Table with declarative configuration. (optional)
Set option to the cluster config.
Parameters:
- path: (string) Option path.
- value: Option value (int, string, table).
Set an option for the selected group.
Parameters:
- path: (string) Option path.
- value: Option value (int, string, table).
Set an option for the selected replicaset.
Parameters:
- path: (string) Option path.
- value: Option value (int, string, table).