Apache Flink - 端到端测试如何终止输入源
Apache Flink - End to End testing how to terminate input source
我在批处理中使用 apache flink 有一段时间了,但现在我们想将这个批处理作业转换为流处理作业。我 运行 遇到的问题是如何 运行 端到端测试。
它在批处理作业中的工作原理
在使用批处理时,我们使用 Cucumber 创建了端到端测试。
- 我们将填充我们从
读取的 hbase table
- 运行批处理作业
- 等待它完成
- 验证结果
流作业中的问题
我们想对流作业做一些类似的事情,除了流作业没有真正完成。
所以:
- 填满我们从中读取的消息队列
- 运行 流作业。
- 等待它完成(如何?)
- 验证结果
我们可以在每次测试后等待 5 秒,并假设所有内容都已处理,但这会大大降低速度。
问题:
有哪些方法或最佳实践可以运行 对流式 flink 作业进行端到端测试,而无需在 x 秒后强制终止 flink 作业
大多数 Flink DataStream 源,如果它们正在从有限输入读取,将在到达末尾时注入值为 LONG.MAX_VALUE 的水印,之后作业将终止。
Flink training exercises illustrate one approach to doing end-to-end testing of Flink jobs. I suggest cloning the github repo and looking at how the tests are setup. They use a custom source and sink 并重定向输入输出进行测试。
中也讨论了这个话题。
我在批处理中使用 apache flink 有一段时间了,但现在我们想将这个批处理作业转换为流处理作业。我 运行 遇到的问题是如何 运行 端到端测试。
它在批处理作业中的工作原理
在使用批处理时,我们使用 Cucumber 创建了端到端测试。
- 我们将填充我们从 读取的 hbase table
- 运行批处理作业
- 等待它完成
- 验证结果
流作业中的问题
我们想对流作业做一些类似的事情,除了流作业没有真正完成。
所以:
- 填满我们从中读取的消息队列
- 运行 流作业。
- 等待它完成(如何?)
- 验证结果
我们可以在每次测试后等待 5 秒,并假设所有内容都已处理,但这会大大降低速度。
问题:
有哪些方法或最佳实践可以运行 对流式 flink 作业进行端到端测试,而无需在 x 秒后强制终止 flink 作业
大多数 Flink DataStream 源,如果它们正在从有限输入读取,将在到达末尾时注入值为 LONG.MAX_VALUE 的水印,之后作业将终止。
Flink training exercises illustrate one approach to doing end-to-end testing of Flink jobs. I suggest cloning the github repo and looking at how the tests are setup. They use a custom source and sink 并重定向输入输出进行测试。
中也讨论了这个话题。