Graylog2 / Graylog2/graylog2-server
IT Tests: improve FixtureImporter to also support mappings
- Dominant language
- Java
- Stars
- 8.1k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 217
Description
The fixture importer for test data in IT tests (`FixtureImporterOS2` and the corresponding ES class) does not support to create type mappings when creating an index from the `messages.json` test data. This could be a useful addition for future tests.
For a currently sporadically failing test, the error message is misleading because the test tries to sort on a field, but because there was no data ingested at that time, the sorting fails and not the assertion about the query result. If there would have been a mapping in place for that field, even though there was no data ingested at that point in time, the sorting would have succeeded.
For reference, the exception with the sorting error:
```org.graylog.plugins.views.search.export.ExportException: Unable to complete export:
at org.graylog.storage.opensearch2.views.export.ExportClient.wrapException(ExportClient.java:60)
at org.graylog.storage.opensearch2.views.export.ExportClient.search(ExportClient.java:55)
at org.graylog.storage.opensearch2.views.export.SearchAfter.search(SearchAfter.java:59)
at org.graylog.storage.opensearch2.views.export.SearchAfter.nextChunk(SearchAfter.java:50)
at org.graylog.storage.opensearch2.views.export.OpenSearchExportBackend.search(OpenSearchExportBackend.java:111)
at org.graylog.storage.opensearch2.views.export.OpenSearchExportBackend.run(OpenSearchExportBackend.java:85)
at org.graylog.storage.opensearch2.views.export.OpenSearchExportITHelper.collectChunksFor(OpenSearchExportITHelper.java:38)
at org.graylog.storage.views.export.ExportITHelper.collectTotalResult(ExportITHelper.java:109)
at org.graylog.storage.views.export.ExportITHelper.runWithExpectedResult(ExportITHelper.java:85)
at org.graylog.storage.opensearch2.views.export.OpenSearchExportBackendIT.usesProvidedTimeZone(OpenSearchExportBackendIT.java:238)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
Caused by: ElasticsearchException{message=ElasticsearchException{message=Unable to perform export query:
OpenSearch exception [type=query_shard_exception, reason=No mapping found for [timestamp] in order to sort on], errorDetails=[OpenSearch exception [type=query_shard_exception, reason=No mapping found for [timestamp] in order to sort on]]}, errorDetails=[]}
... 11 more
Caused by: ElasticsearchException{message=Unable to perform export query:
OpenSearch exception [type=query_shard_exception, reason=No mapping found for [timestamp] in order to sort on], errorDetails=[OpenSearch exception [type=query_shard_exception, reason=No mapping found for [timestamp] in order to sort on]]}
at org.graylog.storage.opensearch2.views.export.ExportClient.search(ExportClient.java:51)
... 9 more
```
Contributor guide
Assessment
This issue has not been assessed yet.