Skip to content

Commit d10c49b

Browse files
committed
config: add isolated option on the instance level
This commit just adds the option into the cluster configuration schema. Next commits will add the relevant logic. Part of tarantool#10796 NO_DOC=tarantool/doc#4632
1 parent ad6f4a3 commit d10c49b

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## feature/config
2+
3+
* Add `isolated` option for instances (gh-10796).

src/box/lua/config/cluster_config.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,13 @@ local nested_cluster_config = schema.new(schema_name, record_from_fields({
202202
instance_config_with_scope('replicaset'),
203203
instances = schema.map({
204204
key = name,
205-
value = instance_config_with_scope('instance'),
205+
value = record_from_fields({
206+
isolated = schema.scalar({
207+
type = 'boolean',
208+
default = false,
209+
}),
210+
instance_config_with_scope('instance'),
211+
}),
206212
}),
207213
}),
208214
}),

test/config-luatest/cluster_config_schema_test.lua

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,11 @@ g.test_defaults = function()
470470

471471
-- Instance defaults.
472472
--
473-
-- There are no additional options.
473+
-- There is an additional option:
474+
--
475+
-- * isolated (default: false)
476+
local exp = table.copy(exp)
477+
exp.isolated = false
474478
local res = cluster_config:apply_default({
475479
groups = {
476480
g = {
@@ -729,13 +733,37 @@ end
729733

730734
-- Verify options consistency on the instance level.
731735
--
732-
-- Expected only instance config fields.
736+
-- Expected instance config fields plus the following additional
737+
-- ones:
738+
--
739+
-- * isolated (boolean)
733740
g.test_additional_options_instance = function()
741+
-- Some valid values for the additional fields.
742+
local additional_options = {
743+
isolated = true,
744+
}
745+
734746
-- Verify that the fields on the given level are instance
735-
-- config fields.
747+
-- config fields plus the given additional ones.
736748
local schema = cluster_config.schema
737749
.fields.groups.value
738750
.fields.replicasets.value
739751
.fields.instances.value
740-
verify_fields(schema, {})
752+
verify_fields(schema, table_keys(additional_options))
753+
754+
-- Verify that the given example values for the additional
755+
-- fields are accepted by the schema on the given level.
756+
cluster_config:validate({
757+
groups = {
758+
g = {
759+
replicasets = {
760+
r = {
761+
instances = {
762+
i = additional_options,
763+
},
764+
},
765+
},
766+
},
767+
},
768+
})
741769
end

0 commit comments

Comments
 (0)