差異處
這裏顯示兩個版本的差異處。
java:wiremock:record-disconnection-behavior [2021/08/07 22:51] tony [Problem] |
java:wiremock:record-disconnection-behavior [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>wiremock}} | ||
- | ====== WireMock - Record Disconnection Behavior ====== | ||
- | ===== Problem ===== | ||
- | 我有一隻待測程式(SUT)會相依於外部服務(External Service),操作流程如下: | ||
- | - SUT觸發一個async command。 | ||
- | - 接著外部服務將會重置而導致SUT無法連線。 | ||
- | - SUT會不停的Get去等待外部服務再次連線。 | ||
- | {{:java:wiremock:wm_test_connection_reset.png|}}\\ | ||
- | 在我導入WireMock要替代外部服務並錄製腳本過程中,發現WireMock只要發生網路連線問題就會回應以下內容: | ||
- | <code> | ||
- | Network failure trying to make a proxied request from WireMock to https://10.146.125.169/api/v1 | ||
- | Connect to 10.146.125.169:443 [/10.146.125.169] failed: Connection timed out: connect | ||
- | </code> | ||
- | {{:java:wiremock:wm_test_connection_reset_and_get_500_error_code.png|}}\\ | ||
- | \\ | ||
- | 這導致SUT接到非預期的500 status code,使工作的執行無法順利完成。本篇文章主要分享我的解決方法。 | ||
- | ===== How to? ===== | ||
- | ===== ===== | ||
- | ---- | ||
- | \\ | ||
- | ~~DISQUS~~ |