From 8a7022dcc2d6f95cdc2b99f4637465823efe7dd5 Mon Sep 17 00:00:00 2001 From: bootjp Date: Thu, 22 Nov 2018 13:01:26 +0900 Subject: [PATCH] Fix style of test case. Signed-off-by: bootjp --- test/plugin/test_out_forward.rb | 87 +++++++++++++++++---------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/test/plugin/test_out_forward.rb b/test/plugin/test_out_forward.rb index 9adb61b06d..946f303fb2 100644 --- a/test/plugin/test_out_forward.rb +++ b/test/plugin/test_out_forward.rb @@ -219,14 +219,14 @@ def read_ack_from_sock(sock, unpacker) test 'verify_connection_at_startup is disabled in default' do @d = d = create_driver(CONFIG) - assert_equal false, d.instance.verify_connection_at_startup + assert_false d.instance.verify_connection_at_startup end test 'verify_connection_at_startup can be enabled' do @d = d = create_driver(CONFIG + %[ verify_connection_at_startup true ]) - assert_equal true, d.instance.verify_connection_at_startup + assert_true d.instance.verify_connection_at_startup end test 'send tags in str (utf-8 strings)' do @@ -787,7 +787,8 @@ def create_target_input_driver(response_stub: nil, disconnect: false, conf: TARG end end - test 'verify_connection_at_startup_nodes_are_not_available' do + sub_test_case 'verify_connection_at_startup' do + test 'nodes are not available' do @d = d = create_driver(CONFIG + %[ verify_connection_at_startup true @@ -797,57 +798,56 @@ def create_target_input_driver(response_stub: nil, disconnect: false, conf: TARG flush_at_shutdown false # suppress errors in d.instance_shutdown ]) - assert_raise Fluent::UnrecoverableError do - d.instance_start + assert_raise Fluent::UnrecoverableError do + d.instance_start + end + d.instance_shutdown end - d.instance_shutdown - end - test 'verify_connection_at_startup_nodes_shared_key_miss_match' do - input_conf = TARGET_CONFIG + %[ + test 'nodes_shared_key_miss_match' do + input_conf = TARGET_CONFIG + %[ self_hostname in.localhost shared_key fluentd-sharedkey ] - target_input_driver = create_target_input_driver(conf: input_conf) - - output_conf = %[ - send_timeout 30 - heartbeat_type transport - transport tls - tls_verify_hostname false - verify_connection_at_startup true - require_ack_response true - ack_response_timeout 5s - - self_hostname localhost - shared_key key_miss_match - - - flush_mode immediate - retry_type periodic - retry_wait 30s - flush_at_shutdown false # suppress errors in d.instance_shutdown - flush_thread_interval 31s - + target_input_driver = create_target_input_driver(conf: input_conf) + output_conf = %[ + send_timeout 30 + heartbeat_type transport + transport tls + tls_verify_hostname false + verify_connection_at_startup true + require_ack_response true + ack_response_timeout 5s + + self_hostname localhost + shared_key key_miss_match + + + flush_mode immediate + retry_type periodic + retry_wait 30s + flush_at_shutdown false # suppress errors in d.instance_shutdown + flush_thread_interval 31s + - - host #{TARGET_HOST} - port #{TARGET_PORT} - - ] - @d = d = create_driver(output_conf) + + host #{TARGET_HOST} + port #{TARGET_PORT} + + ] + @d = d = create_driver(output_conf) - target_input_driver.run(expect_records: 1, timeout: 15) do - assert_raise Fluent::UnrecoverableError do - d.instance_start + target_input_driver.run(expect_records: 1, timeout: 15) do + assert_raise Fluent::UnrecoverableError do + d.instance_start + end + d.instance_shutdown end - d.instance_shutdown end - end - test 'verify_connection_at_startup_nodes_shared_key_match' do + test 'nodes_shared_key_match' do input_conf = TARGET_CONFIG + %[ self_hostname in.localhost @@ -872,7 +872,7 @@ def create_target_input_driver(response_stub: nil, disconnect: false, conf: TARG port #{TARGET_PORT} shared_key fluentd-sharedkey - ] + ] @d = d = create_driver(output_conf) time = event_time("2011-01-02 13:14:15 UTC") @@ -894,4 +894,5 @@ def create_target_input_driver(response_stub: nil, disconnect: false, conf: TARG assert_equal(['test', time, records[0]], events[0]) assert_equal(['test', time, records[1]], events[1]) end + end end