Skip to content

ESQL: Add curly braces and other unusual chars to random identifier generation in tests #121166

Open
@alex-spies

Description

@alex-spies

@idegtiarenko 's awesome IdentifierGenerator already generates a lot of relevant index patterns randomly, which is excellent for gaining confidence of covering all the bases whenever index names/patterns matter.

One, likely rare, edge case is when index names include curly braces or plusses. These are permitted per the docs and can in fact be used. These are tricky because they have special meaning in date math, so that valid patterns using curly braces/pluses (and maybe other chars) and date math need to escape such chars - and it'd be good to test that we correctly respect such escaping.

There are many other valid characters that are currently uncovered, so we should ideally make the identifier generator generate index names/patterns randomly using the whole range of permitted characters. Examples include @, and unicode like the heart character.

Examples that work on current main:

$ curl -u elastic:password -HContent-Type:application/json 'localhost:9200/test%7B/_doc?refresh' -d '{"a": 1}'

$ curl -u elastic:password -HContent-Type:application/json 'localhost:9200/test%40/_doc?refresh' -d '{"a": 1}

$ curl -u elastic:password -HContent-Type:application/json 'localhost:9200/test♥/_doc?refresh' -d '{"a": 1}'

$ curl -u elastic:password -HContent-Type:application/json 'localhost:9200/test+/_doc?refresh' -d '{"a": 1}'

$ curl -u elastic:password -H "Content-Type: application/json" "127.0.0.1:9200/_query?format=txt" -d '
{                
  "query": "from test* metadata _index"
}'
       a       |    _index     
---------------+---------------
1              |test+
1              |test@          
1              |test♥          
1              |test{

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/ES|QLAKA ESQL>testIssues or PRs that are addressing/adding testsTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions