test/plugin/test_out_http.rb in fluent-plugin-out-http-0.1.2 vs test/plugin/test_out_http.rb in fluent-plugin-out-http-0.1.3

- old
+ new

@@ -149,10 +149,15 @@ CONFIG_HTTP_ERROR = %[ endpoint_url https://127.0.0.1:#{TEST_LISTEN_PORT + 1}/api/ ] + CONFIG_HTTP_ERROR_SUPPRESSED = %[ + endpoint_url https://127.0.0.1:#{TEST_LISTEN_PORT + 1}/api/ + raise_on_error false + ] + RATE_LIMIT_MSEC = 1200 CONFIG_RATE_LIMIT = %[ endpoint_url http://127.0.0.1:#{TEST_LISTEN_PORT}/api/ rate_limit_msec #{RATE_LIMIT_MSEC} @@ -227,11 +232,18 @@ assert_equal 1, record[:json]['otherfield'] assert_equal binary_string, record[:json]['binary'] assert_nil record[:auth] end - def test_http_error + def test_http_error_is_raised d = create_driver CONFIG_HTTP_ERROR + assert_raise Errno::ECONNREFUSED do + d.emit({ 'field1' => 50 }) + end + end + + def test_http_error_is_suppressed_with_raise_on_error_false + d = create_driver CONFIG_HTTP_ERROR_SUPPRESSED d.emit({ 'field1' => 50 }) d.run # drive asserts the next output chain is called; # so no exception means our plugin handled the error