-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TSDB: move TimeSeriesModeIT to yaml tests (#80933)
I move TimeSeriesModeIT to yaml tests. I move the below lists to 15_timestamp_mapping.yml: ``` testTimestampMillis -> date testTimestampNanos -> date_nanos testAddsTimestamp -> automatically add with date testBadTimestamp -> reject @timestamp with wrong type testDisabledTimeStampMapper -> reject timestamp meta field with wrong type ``` And add some tests in 15_timestamp_mapping.yml: ``` testBadTimeStampMapper -> reject bad timestamp meta field testWithoutTimestamp -> write without timestamp testAddTimeStampMeta -> add timestamp meta testEnabledTimeStampMapper -> enable timestamp meta field ``` AND move the below lists to 10_settings.yml: ``` testEnableTimestampRange -> set start_time and end_time ``` And add some tests in 10_settings.yml: ``` testBadStartTime\testBadEndTime -> set bad start_time and end_time ```
- Loading branch information
Showing
3 changed files
with
198 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,7 +161,7 @@ reject @timestamp with wrong type: | |
reject timestamp meta field with wrong type: | ||
- skip: | ||
version: " - 8.0.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
reason: introduced in 8.1.0 | ||
|
||
- do: | ||
catch: /\[_data_stream_timestamp\] meta field has been disabled/ | ||
|
@@ -177,3 +177,138 @@ reject timestamp meta field with wrong type: | |
mappings: | ||
_data_stream_timestamp: | ||
enabled: false | ||
|
||
--- | ||
enable timestamp meta field: | ||
- skip: | ||
version: " - 8.0.99" | ||
reason: introduced in 8.1.0 | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
routing_path: [metricset] | ||
number_of_replicas: 0 | ||
number_of_shards: 2 | ||
mappings: | ||
_data_stream_timestamp: | ||
enabled: true | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test | ||
- match: { "[email protected]": date } | ||
- match: { 'test.mappings._data_stream_timestamp.enabled': true } | ||
|
||
--- | ||
reject bad timestamp meta field: | ||
- skip: | ||
version: " - 8.0.99" | ||
reason: introduced in 8.1.0 | ||
|
||
- do: | ||
catch: /\[_data_stream_timestamp\] config must be an object/ | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
routing_path: [metricset] | ||
number_of_replicas: 0 | ||
number_of_shards: 2 | ||
mappings: | ||
_data_stream_timestamp: enabled | ||
|
||
--- | ||
write without timestamp: | ||
- skip: | ||
version: " - 8.0.99" | ||
reason: introduced in 8.1.0 | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
routing_path: [metricset] | ||
number_of_replicas: 0 | ||
number_of_shards: 2 | ||
mappings: | ||
properties: | ||
"@timestamp": | ||
type: date | ||
metricset: | ||
type: keyword | ||
time_series_dimension: true | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test | ||
- match: { "[email protected]": date } | ||
- match: { 'test.mappings._data_stream_timestamp.enabled': true } | ||
|
||
- do: | ||
catch: /data stream timestamp field \[@timestamp\] is missing/ | ||
index: | ||
index: test | ||
body: | ||
"metricset": "pod" | ||
|
||
--- | ||
explicitly enable timestamp meta field: | ||
- skip: | ||
version: " - 8.0.99" | ||
reason: introduced in 8.1.0 | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
routing_path: [metricset] | ||
number_of_replicas: 0 | ||
number_of_shards: 2 | ||
mappings: | ||
properties: | ||
"@timestamp": | ||
type: date | ||
meta: | ||
field_meta: time_series | ||
metricset: | ||
type: keyword | ||
time_series_dimension: true | ||
|
||
- do: | ||
index: | ||
refresh: true | ||
index: test | ||
body: { | ||
"@timestamp": 1632625793000, | ||
"metricset": "pod", | ||
"new_field" : "value" | ||
} | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
docvalue_fields: [ '@timestamp', 'new_field.keyword' ] | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0.fields.@timestamp: [ "2021-09-26T03:09:53.000Z" ] } | ||
- match: { hits.hits.0.fields.new_field\.keyword: [ "value" ] } | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test | ||
- match: { "[email protected]": date } | ||
- match: { "[email protected]_meta": time_series } | ||
- match: { 'test.mappings._data_stream_timestamp.enabled': true } |
Oops, something went wrong.