Skip to content

Commit bb0fd3f

Browse files
authored
Merge pull request #4433 from daipom/ci-fix-unstable-tests-of-out_forward
CI: Fix unstable tests of out_forward
2 parents d55f444 + 5d18f35 commit bb0fd3f

File tree

1 file changed

+25
-37
lines changed

1 file changed

+25
-37
lines changed

Diff for: test/plugin/test_out_forward.rb

+25-37
Original file line numberDiff line numberDiff line change
@@ -1248,27 +1248,22 @@ def plugin_id_for_test?
12481248
target_input_driver = create_target_input_driver(conf: target_config)
12491249
output_conf = config
12501250
d = create_driver(output_conf)
1251-
d.instance_start
12521251

1253-
begin
1254-
chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
1255-
mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
1256-
linger_timeout: anything,
1257-
send_timeout: anything,
1258-
recv_timeout: anything,
1259-
connect_timeout: anything
1260-
) { |sock| mock(sock).close.once; sock }.twice
1252+
chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
1253+
mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
1254+
linger_timeout: anything,
1255+
send_timeout: anything,
1256+
recv_timeout: anything,
1257+
connect_timeout: anything
1258+
) { |sock| mock(sock).close.once; sock }.twice
12611259

1262-
target_input_driver.run(timeout: 15) do
1263-
d.run(shutdown: false) do
1264-
node = d.instance.nodes.first
1265-
2.times do
1266-
node.send_data('test', chunk) rescue nil
1267-
end
1260+
target_input_driver.run(timeout: 15) do
1261+
d.run do
1262+
node = d.instance.nodes.first
1263+
2.times do
1264+
node.send_data('test', chunk) rescue nil
12681265
end
12691266
end
1270-
ensure
1271-
d.instance_shutdown
12721267
end
12731268
end
12741269

@@ -1282,7 +1277,6 @@ def plugin_id_for_test?
12821277
port #{@target_port}
12831278
</server>
12841279
])
1285-
d.instance_start
12861280
assert_nothing_raised { d.run }
12871281
end
12881282

@@ -1294,33 +1288,28 @@ def plugin_id_for_test?
12941288
keepalive_timeout 2
12951289
]
12961290
d = create_driver(output_conf)
1297-
d.instance_start
12981291

1299-
begin
1300-
chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
1301-
mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
1302-
linger_timeout: anything,
1303-
send_timeout: anything,
1304-
recv_timeout: anything,
1305-
connect_timeout: anything
1306-
) { |sock| mock(sock).close.once; sock }.once
1292+
chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
1293+
mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
1294+
linger_timeout: anything,
1295+
send_timeout: anything,
1296+
recv_timeout: anything,
1297+
connect_timeout: anything
1298+
) { |sock| mock(sock).close.once; sock }.once
13071299

1308-
target_input_driver.run(timeout: 15) do
1309-
d.run(shutdown: false) do
1310-
node = d.instance.nodes.first
1311-
2.times do
1312-
node.send_data('test', chunk) rescue nil
1313-
end
1300+
target_input_driver.run(timeout: 15) do
1301+
d.run do
1302+
node = d.instance.nodes.first
1303+
2.times do
1304+
node.send_data('test', chunk) rescue nil
13141305
end
13151306
end
1316-
ensure
1317-
d.instance_shutdown
13181307
end
13191308
end
13201309

13211310
test 'create timer of purging obsolete sockets' do
13221311
output_conf = config + %[keepalive true]
1323-
d = create_driver(output_conf)
1312+
@d = d = create_driver(output_conf)
13241313

13251314
mock(d.instance).timer_execute(:out_forward_heartbeat_request, 1).once
13261315
mock(d.instance).timer_execute(:out_forward_keep_alived_socket_watcher, 5).once
@@ -1336,7 +1325,6 @@ def plugin_id_for_test?
13361325
keepalive_timeout 2
13371326
]
13381327
d = create_driver(output_conf)
1339-
d.instance_start
13401328

13411329
chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
13421330
mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,

0 commit comments

Comments
 (0)