简体   繁体   English

如何测试Elasticsearch索引创建?

[英]How to test Elasticsearch index creation?

I would like to write a JUnit Test using any kind of embedded Elasticsearch engine in order to test my services which should create indexes with mappings on start-up. 我想使用任何嵌入式Elasticsearch引擎编写JUnit测试,以测试我的服务,该服务应在启动时使用映射创建索引。 What is the best way to do it? 最好的方法是什么?

Probably, it would be also enough to use ESTestCase. 也许,使用ESTestCase也足够了。 Unfortunately, I cannot find simple usage examples. 不幸的是,我找不到简单的用法示例。 Could anyone provide one? 有人可以提供吗?

There is no embedded Elasticsearch since 5.x any more. 从5.x版本开始,不再有嵌入式Elasticsearch。 I would use Testcontainers for this: https://github.com/dadoonet/testcontainers-java-module-elasticsearch 我将为此使用Testcontainers: https : //github.com/dadoonet/testcontainers-java-module-elasticsearch

PS: This code will soon move to the Testcontainers repo. PS:此代码将很快移至Testcontainers存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何单元测试实例创建? - How to unit test instance creation? 如何对与 Elasticsearch 交互的 Go 代码进行单元测试 - How to unit test go code that interacts with Elasticsearch 我如何单元测试/模拟 ElasticSearch - How do I Unit test/mock ElasticSearch 如何在 pytest 测试中模拟 elasticsearch object? - how to mock an elasticsearch object in pytest test? 如何在接口默认方法中对新对象创建进行单元测试? - How to unit test new object creation in interface default method? 创建对象的单元测试 - Unit test for creation object 如果数据源创建失败,如何测试Spring Boot不会启动 - How to test that Spring Boot does *not* start if datasource creation failed 如何对 Active Directory 对象创建进行单元测试? - How do I unit test Active Directory object creation? Pester如何模拟“测试存在(未找到)-创建-再次测试以确认创建”模式中的“测试”功能? - How can Pester mock the “test” function in the pattern “test existence (not found) - create - test again to confirm creation”? 如何在Android Studio中选择/编辑适当的文件夹以进行单元测试创​​建? - How to select/edit proper folder for unit test creation in Android Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM