Skip to content

Settings: Combining affix setting with group settings results in namespace issues #28047

@spinscale

Description

@spinscale

Description of the problem including expected versus actual behavior:

When combining an affix setting with a group setting, the affix setting does not correctly find the namespaces anymore due to a non-working regex in Setting.AffixKey, when any setting inside that group setting is supplied

Steps to reproduce:

public void testAffixNamespacesWithGroupSetting() {
    final Setting.AffixSetting<Settings> affixSetting =
            Setting.affixKeySetting("prefix.","suffix",
                    (key) -> Setting.groupSetting(key + ".", Setting.Property.Dynamic, Setting.Property.NodeScope));

    // works
    assertThat(affixSetting.getNamespaces(Settings.builder().put("prefix.infix.suffix", "anything").build()), hasSize(1));
    // breaks, has size 0
    assertThat(affixSetting.getNamespaces(Settings.builder().put("prefix.infix.suffix.anything", "anything").build()), hasSize(1));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions