fluentd222 1.16.2-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.deepsource.toml +13 -0
 - data/.github/ISSUE_TEMPLATE/bug_report.yaml +71 -0
 - data/.github/ISSUE_TEMPLATE/config.yml +5 -0
 - data/.github/ISSUE_TEMPLATE/feature_request.yaml +39 -0
 - data/.github/ISSUE_TEMPLATE.md +17 -0
 - data/.github/PULL_REQUEST_TEMPLATE.md +14 -0
 - data/.github/workflows/stale-actions.yml +24 -0
 - data/.github/workflows/test-ruby-head.yaml +31 -0
 - data/.github/workflows/test.yaml +32 -0
 - data/.gitignore +30 -0
 - data/ADOPTERS.md +5 -0
 - data/AUTHORS +2 -0
 - data/CHANGELOG.md +2720 -0
 - data/CONTRIBUTING.md +45 -0
 - data/GOVERNANCE.md +55 -0
 - data/Gemfile +9 -0
 - data/GithubWorkflow.md +78 -0
 - data/LICENSE +202 -0
 - data/MAINTAINERS.md +13 -0
 - data/README.md +75 -0
 - data/Rakefile +79 -0
 - data/SECURITY.md +14 -0
 - data/bin/fluent-binlog-reader +7 -0
 - data/bin/fluent-ca-generate +6 -0
 - data/bin/fluent-cap-ctl +7 -0
 - data/bin/fluent-cat +5 -0
 - data/bin/fluent-ctl +7 -0
 - data/bin/fluent-debug +5 -0
 - data/bin/fluent-gem +9 -0
 - data/bin/fluent-plugin-config-format +5 -0
 - data/bin/fluent-plugin-generate +5 -0
 - data/bin/fluentd +15 -0
 - data/code-of-conduct.md +3 -0
 - data/docs/SECURITY_AUDIT.pdf +0 -0
 - data/example/copy_roundrobin.conf +39 -0
 - data/example/counter.conf +18 -0
 - data/example/filter_stdout.conf +22 -0
 - data/example/in_forward.conf +14 -0
 - data/example/in_forward_client.conf +37 -0
 - data/example/in_forward_shared_key.conf +15 -0
 - data/example/in_forward_tls.conf +14 -0
 - data/example/in_forward_users.conf +24 -0
 - data/example/in_forward_workers.conf +21 -0
 - data/example/in_http.conf +16 -0
 - data/example/in_out_forward.conf +17 -0
 - data/example/in_sample_blocks.conf +17 -0
 - data/example/in_sample_with_compression.conf +23 -0
 - data/example/in_syslog.conf +15 -0
 - data/example/in_tail.conf +14 -0
 - data/example/in_tcp.conf +13 -0
 - data/example/in_udp.conf +13 -0
 - data/example/logevents.conf +25 -0
 - data/example/multi_filters.conf +61 -0
 - data/example/out_copy.conf +20 -0
 - data/example/out_exec_filter.conf +42 -0
 - data/example/out_file.conf +13 -0
 - data/example/out_forward.conf +35 -0
 - data/example/out_forward_buf_file.conf +23 -0
 - data/example/out_forward_client.conf +109 -0
 - data/example/out_forward_heartbeat_none.conf +16 -0
 - data/example/out_forward_sd.conf +17 -0
 - data/example/out_forward_shared_key.conf +36 -0
 - data/example/out_forward_tls.conf +18 -0
 - data/example/out_forward_users.conf +65 -0
 - data/example/out_null.conf +36 -0
 - data/example/sd.yaml +8 -0
 - data/example/secondary_file.conf +42 -0
 - data/example/suppress_config_dump.conf +7 -0
 - data/example/v0_12_filter.conf +78 -0
 - data/example/v1_literal_example.conf +36 -0
 - data/example/worker_section.conf +36 -0
 - data/fluent.conf +139 -0
 - data/fluentd.gemspec +54 -0
 - data/lib/fluent/agent.rb +168 -0
 - data/lib/fluent/capability.rb +87 -0
 - data/lib/fluent/clock.rb +66 -0
 - data/lib/fluent/command/binlog_reader.rb +244 -0
 - data/lib/fluent/command/bundler_injection.rb +45 -0
 - data/lib/fluent/command/ca_generate.rb +184 -0
 - data/lib/fluent/command/cap_ctl.rb +174 -0
 - data/lib/fluent/command/cat.rb +365 -0
 - data/lib/fluent/command/ctl.rb +180 -0
 - data/lib/fluent/command/debug.rb +103 -0
 - data/lib/fluent/command/fluentd.rb +374 -0
 - data/lib/fluent/command/plugin_config_formatter.rb +308 -0
 - data/lib/fluent/command/plugin_generator.rb +365 -0
 - data/lib/fluent/compat/call_super_mixin.rb +76 -0
 - data/lib/fluent/compat/detach_process_mixin.rb +33 -0
 - data/lib/fluent/compat/exec_util.rb +129 -0
 - data/lib/fluent/compat/file_util.rb +54 -0
 - data/lib/fluent/compat/filter.rb +68 -0
 - data/lib/fluent/compat/formatter.rb +111 -0
 - data/lib/fluent/compat/formatter_utils.rb +85 -0
 - data/lib/fluent/compat/handle_tag_and_time_mixin.rb +62 -0
 - data/lib/fluent/compat/handle_tag_name_mixin.rb +53 -0
 - data/lib/fluent/compat/input.rb +49 -0
 - data/lib/fluent/compat/output.rb +721 -0
 - data/lib/fluent/compat/output_chain.rb +60 -0
 - data/lib/fluent/compat/parser.rb +310 -0
 - data/lib/fluent/compat/parser_utils.rb +40 -0
 - data/lib/fluent/compat/propagate_default.rb +62 -0
 - data/lib/fluent/compat/record_filter_mixin.rb +34 -0
 - data/lib/fluent/compat/set_tag_key_mixin.rb +50 -0
 - data/lib/fluent/compat/set_time_key_mixin.rb +69 -0
 - data/lib/fluent/compat/socket_util.rb +165 -0
 - data/lib/fluent/compat/string_util.rb +34 -0
 - data/lib/fluent/compat/structured_format_mixin.rb +26 -0
 - data/lib/fluent/compat/type_converter.rb +90 -0
 - data/lib/fluent/config/basic_parser.rb +123 -0
 - data/lib/fluent/config/configure_proxy.rb +424 -0
 - data/lib/fluent/config/dsl.rb +152 -0
 - data/lib/fluent/config/element.rb +265 -0
 - data/lib/fluent/config/error.rb +44 -0
 - data/lib/fluent/config/literal_parser.rb +286 -0
 - data/lib/fluent/config/parser.rb +107 -0
 - data/lib/fluent/config/section.rb +272 -0
 - data/lib/fluent/config/types.rb +249 -0
 - data/lib/fluent/config/v1_parser.rb +192 -0
 - data/lib/fluent/config/yaml_parser/fluent_value.rb +47 -0
 - data/lib/fluent/config/yaml_parser/loader.rb +108 -0
 - data/lib/fluent/config/yaml_parser/parser.rb +166 -0
 - data/lib/fluent/config/yaml_parser/section_builder.rb +107 -0
 - data/lib/fluent/config/yaml_parser.rb +56 -0
 - data/lib/fluent/config.rb +89 -0
 - data/lib/fluent/configurable.rb +201 -0
 - data/lib/fluent/counter/base_socket.rb +44 -0
 - data/lib/fluent/counter/client.rb +297 -0
 - data/lib/fluent/counter/error.rb +86 -0
 - data/lib/fluent/counter/mutex_hash.rb +163 -0
 - data/lib/fluent/counter/server.rb +273 -0
 - data/lib/fluent/counter/store.rb +205 -0
 - data/lib/fluent/counter/validator.rb +145 -0
 - data/lib/fluent/counter.rb +23 -0
 - data/lib/fluent/daemon.rb +13 -0
 - data/lib/fluent/daemonizer.rb +88 -0
 - data/lib/fluent/engine.rb +253 -0
 - data/lib/fluent/env.rb +40 -0
 - data/lib/fluent/error.rb +37 -0
 - data/lib/fluent/event.rb +330 -0
 - data/lib/fluent/event_router.rb +315 -0
 - data/lib/fluent/ext_monitor_require.rb +28 -0
 - data/lib/fluent/file_wrapper.rb +137 -0
 - data/lib/fluent/filter.rb +21 -0
 - data/lib/fluent/fluent_log_event_router.rb +139 -0
 - data/lib/fluent/formatter.rb +23 -0
 - data/lib/fluent/input.rb +21 -0
 - data/lib/fluent/label.rb +46 -0
 - data/lib/fluent/load.rb +34 -0
 - data/lib/fluent/log/console_adapter.rb +66 -0
 - data/lib/fluent/log.rb +752 -0
 - data/lib/fluent/match.rb +187 -0
 - data/lib/fluent/mixin.rb +31 -0
 - data/lib/fluent/msgpack_factory.rb +111 -0
 - data/lib/fluent/oj_options.rb +61 -0
 - data/lib/fluent/output.rb +29 -0
 - data/lib/fluent/output_chain.rb +23 -0
 - data/lib/fluent/parser.rb +23 -0
 - data/lib/fluent/plugin/bare_output.rb +104 -0
 - data/lib/fluent/plugin/base.rb +214 -0
 - data/lib/fluent/plugin/buf_file.rb +242 -0
 - data/lib/fluent/plugin/buf_file_single.rb +254 -0
 - data/lib/fluent/plugin/buf_memory.rb +34 -0
 - data/lib/fluent/plugin/buffer/chunk.rb +240 -0
 - data/lib/fluent/plugin/buffer/file_chunk.rb +413 -0
 - data/lib/fluent/plugin/buffer/file_single_chunk.rb +310 -0
 - data/lib/fluent/plugin/buffer/memory_chunk.rb +91 -0
 - data/lib/fluent/plugin/buffer.rb +941 -0
 - data/lib/fluent/plugin/compressable.rb +96 -0
 - data/lib/fluent/plugin/exec_util.rb +22 -0
 - data/lib/fluent/plugin/file_util.rb +22 -0
 - data/lib/fluent/plugin/filter.rb +127 -0
 - data/lib/fluent/plugin/filter_grep.rb +189 -0
 - data/lib/fluent/plugin/filter_parser.rb +130 -0
 - data/lib/fluent/plugin/filter_record_transformer.rb +324 -0
 - data/lib/fluent/plugin/filter_stdout.rb +53 -0
 - data/lib/fluent/plugin/formatter.rb +75 -0
 - data/lib/fluent/plugin/formatter_csv.rb +78 -0
 - data/lib/fluent/plugin/formatter_hash.rb +35 -0
 - data/lib/fluent/plugin/formatter_json.rb +59 -0
 - data/lib/fluent/plugin/formatter_ltsv.rb +44 -0
 - data/lib/fluent/plugin/formatter_msgpack.rb +33 -0
 - data/lib/fluent/plugin/formatter_out_file.rb +53 -0
 - data/lib/fluent/plugin/formatter_single_value.rb +36 -0
 - data/lib/fluent/plugin/formatter_stdout.rb +76 -0
 - data/lib/fluent/plugin/formatter_tsv.rb +40 -0
 - data/lib/fluent/plugin/in_debug_agent.rb +71 -0
 - data/lib/fluent/plugin/in_dummy.rb +18 -0
 - data/lib/fluent/plugin/in_exec.rb +110 -0
 - data/lib/fluent/plugin/in_forward.rb +473 -0
 - data/lib/fluent/plugin/in_gc_stat.rb +72 -0
 - data/lib/fluent/plugin/in_http.rb +677 -0
 - data/lib/fluent/plugin/in_monitor_agent.rb +412 -0
 - data/lib/fluent/plugin/in_object_space.rb +93 -0
 - data/lib/fluent/plugin/in_sample.rb +141 -0
 - data/lib/fluent/plugin/in_syslog.rb +276 -0
 - data/lib/fluent/plugin/in_tail/group_watch.rb +204 -0
 - data/lib/fluent/plugin/in_tail/position_file.rb +269 -0
 - data/lib/fluent/plugin/in_tail.rb +1299 -0
 - data/lib/fluent/plugin/in_tcp.rb +226 -0
 - data/lib/fluent/plugin/in_udp.rb +92 -0
 - data/lib/fluent/plugin/in_unix.rb +195 -0
 - data/lib/fluent/plugin/input.rb +75 -0
 - data/lib/fluent/plugin/metrics.rb +119 -0
 - data/lib/fluent/plugin/metrics_local.rb +96 -0
 - data/lib/fluent/plugin/multi_output.rb +195 -0
 - data/lib/fluent/plugin/out_copy.rb +120 -0
 - data/lib/fluent/plugin/out_exec.rb +105 -0
 - data/lib/fluent/plugin/out_exec_filter.rb +319 -0
 - data/lib/fluent/plugin/out_file.rb +340 -0
 - data/lib/fluent/plugin/out_forward/ack_handler.rb +176 -0
 - data/lib/fluent/plugin/out_forward/connection_manager.rb +113 -0
 - data/lib/fluent/plugin/out_forward/error.rb +28 -0
 - data/lib/fluent/plugin/out_forward/failure_detector.rb +84 -0
 - data/lib/fluent/plugin/out_forward/handshake_protocol.rb +125 -0
 - data/lib/fluent/plugin/out_forward/load_balancer.rb +114 -0
 - data/lib/fluent/plugin/out_forward/socket_cache.rb +142 -0
 - data/lib/fluent/plugin/out_forward.rb +826 -0
 - data/lib/fluent/plugin/out_http.rb +275 -0
 - data/lib/fluent/plugin/out_null.rb +74 -0
 - data/lib/fluent/plugin/out_relabel.rb +32 -0
 - data/lib/fluent/plugin/out_roundrobin.rb +84 -0
 - data/lib/fluent/plugin/out_secondary_file.rb +148 -0
 - data/lib/fluent/plugin/out_stdout.rb +74 -0
 - data/lib/fluent/plugin/out_stream.rb +130 -0
 - data/lib/fluent/plugin/output.rb +1603 -0
 - data/lib/fluent/plugin/owned_by_mixin.rb +41 -0
 - data/lib/fluent/plugin/parser.rb +274 -0
 - data/lib/fluent/plugin/parser_apache.rb +28 -0
 - data/lib/fluent/plugin/parser_apache2.rb +88 -0
 - data/lib/fluent/plugin/parser_apache_error.rb +26 -0
 - data/lib/fluent/plugin/parser_csv.rb +114 -0
 - data/lib/fluent/plugin/parser_json.rb +96 -0
 - data/lib/fluent/plugin/parser_ltsv.rb +51 -0
 - data/lib/fluent/plugin/parser_msgpack.rb +50 -0
 - data/lib/fluent/plugin/parser_multiline.rb +152 -0
 - data/lib/fluent/plugin/parser_nginx.rb +28 -0
 - data/lib/fluent/plugin/parser_none.rb +36 -0
 - data/lib/fluent/plugin/parser_regexp.rb +68 -0
 - data/lib/fluent/plugin/parser_syslog.rb +496 -0
 - data/lib/fluent/plugin/parser_tsv.rb +42 -0
 - data/lib/fluent/plugin/sd_file.rb +156 -0
 - data/lib/fluent/plugin/sd_srv.rb +135 -0
 - data/lib/fluent/plugin/sd_static.rb +58 -0
 - data/lib/fluent/plugin/service_discovery.rb +65 -0
 - data/lib/fluent/plugin/socket_util.rb +22 -0
 - data/lib/fluent/plugin/storage.rb +84 -0
 - data/lib/fluent/plugin/storage_local.rb +162 -0
 - data/lib/fluent/plugin/string_util.rb +22 -0
 - data/lib/fluent/plugin.rb +206 -0
 - data/lib/fluent/plugin_helper/cert_option.rb +191 -0
 - data/lib/fluent/plugin_helper/child_process.rb +369 -0
 - data/lib/fluent/plugin_helper/compat_parameters.rb +343 -0
 - data/lib/fluent/plugin_helper/counter.rb +51 -0
 - data/lib/fluent/plugin_helper/event_emitter.rb +100 -0
 - data/lib/fluent/plugin_helper/event_loop.rb +170 -0
 - data/lib/fluent/plugin_helper/extract.rb +104 -0
 - data/lib/fluent/plugin_helper/formatter.rb +147 -0
 - data/lib/fluent/plugin_helper/http_server/app.rb +79 -0
 - data/lib/fluent/plugin_helper/http_server/compat/server.rb +92 -0
 - data/lib/fluent/plugin_helper/http_server/compat/ssl_context_extractor.rb +52 -0
 - data/lib/fluent/plugin_helper/http_server/compat/webrick_handler.rb +58 -0
 - data/lib/fluent/plugin_helper/http_server/methods.rb +35 -0
 - data/lib/fluent/plugin_helper/http_server/request.rb +42 -0
 - data/lib/fluent/plugin_helper/http_server/router.rb +54 -0
 - data/lib/fluent/plugin_helper/http_server/server.rb +94 -0
 - data/lib/fluent/plugin_helper/http_server/ssl_context_builder.rb +41 -0
 - data/lib/fluent/plugin_helper/http_server.rb +135 -0
 - data/lib/fluent/plugin_helper/inject.rb +154 -0
 - data/lib/fluent/plugin_helper/metrics.rb +129 -0
 - data/lib/fluent/plugin_helper/parser.rb +147 -0
 - data/lib/fluent/plugin_helper/record_accessor.rb +207 -0
 - data/lib/fluent/plugin_helper/retry_state.rb +219 -0
 - data/lib/fluent/plugin_helper/server.rb +828 -0
 - data/lib/fluent/plugin_helper/service_discovery/manager.rb +146 -0
 - data/lib/fluent/plugin_helper/service_discovery/round_robin_balancer.rb +43 -0
 - data/lib/fluent/plugin_helper/service_discovery.rb +125 -0
 - data/lib/fluent/plugin_helper/socket.rb +288 -0
 - data/lib/fluent/plugin_helper/socket_option.rb +98 -0
 - data/lib/fluent/plugin_helper/storage.rb +349 -0
 - data/lib/fluent/plugin_helper/thread.rb +180 -0
 - data/lib/fluent/plugin_helper/timer.rb +92 -0
 - data/lib/fluent/plugin_helper.rb +75 -0
 - data/lib/fluent/plugin_id.rb +93 -0
 - data/lib/fluent/process.rb +22 -0
 - data/lib/fluent/registry.rb +117 -0
 - data/lib/fluent/root_agent.rb +372 -0
 - data/lib/fluent/rpc.rb +95 -0
 - data/lib/fluent/static_config_analysis.rb +194 -0
 - data/lib/fluent/supervisor.rb +1076 -0
 - data/lib/fluent/system_config.rb +189 -0
 - data/lib/fluent/test/base.rb +78 -0
 - data/lib/fluent/test/driver/base.rb +231 -0
 - data/lib/fluent/test/driver/base_owned.rb +83 -0
 - data/lib/fluent/test/driver/base_owner.rb +135 -0
 - data/lib/fluent/test/driver/event_feeder.rb +98 -0
 - data/lib/fluent/test/driver/filter.rb +61 -0
 - data/lib/fluent/test/driver/formatter.rb +30 -0
 - data/lib/fluent/test/driver/input.rb +31 -0
 - data/lib/fluent/test/driver/multi_output.rb +53 -0
 - data/lib/fluent/test/driver/output.rb +102 -0
 - data/lib/fluent/test/driver/parser.rb +30 -0
 - data/lib/fluent/test/driver/storage.rb +30 -0
 - data/lib/fluent/test/driver/test_event_router.rb +45 -0
 - data/lib/fluent/test/filter_test.rb +77 -0
 - data/lib/fluent/test/formatter_test.rb +65 -0
 - data/lib/fluent/test/helpers.rb +134 -0
 - data/lib/fluent/test/input_test.rb +174 -0
 - data/lib/fluent/test/log.rb +79 -0
 - data/lib/fluent/test/output_test.rb +156 -0
 - data/lib/fluent/test/parser_test.rb +70 -0
 - data/lib/fluent/test/startup_shutdown.rb +44 -0
 - data/lib/fluent/test.rb +58 -0
 - data/lib/fluent/time.rb +512 -0
 - data/lib/fluent/timezone.rb +171 -0
 - data/lib/fluent/tls.rb +81 -0
 - data/lib/fluent/unique_id.rb +39 -0
 - data/lib/fluent/variable_store.rb +40 -0
 - data/lib/fluent/version.rb +21 -0
 - data/lib/fluent/win32api.rb +38 -0
 - data/lib/fluent/winsvc.rb +100 -0
 - data/templates/new_gem/Gemfile +3 -0
 - data/templates/new_gem/README.md.erb +43 -0
 - data/templates/new_gem/Rakefile +13 -0
 - data/templates/new_gem/fluent-plugin.gemspec.erb +27 -0
 - data/templates/new_gem/lib/fluent/plugin/filter.rb.erb +14 -0
 - data/templates/new_gem/lib/fluent/plugin/formatter.rb.erb +14 -0
 - data/templates/new_gem/lib/fluent/plugin/input.rb.erb +11 -0
 - data/templates/new_gem/lib/fluent/plugin/output.rb.erb +11 -0
 - data/templates/new_gem/lib/fluent/plugin/parser.rb.erb +15 -0
 - data/templates/new_gem/lib/fluent/plugin/storage.rb.erb +40 -0
 - data/templates/new_gem/test/helper.rb.erb +7 -0
 - data/templates/new_gem/test/plugin/test_filter.rb.erb +18 -0
 - data/templates/new_gem/test/plugin/test_formatter.rb.erb +18 -0
 - data/templates/new_gem/test/plugin/test_input.rb.erb +18 -0
 - data/templates/new_gem/test/plugin/test_output.rb.erb +18 -0
 - data/templates/new_gem/test/plugin/test_parser.rb.erb +18 -0
 - data/templates/new_gem/test/plugin/test_storage.rb.erb +18 -0
 - data/templates/plugin_config_formatter/param.md-compact.erb +25 -0
 - data/templates/plugin_config_formatter/param.md-table.erb +10 -0
 - data/templates/plugin_config_formatter/param.md.erb +34 -0
 - data/templates/plugin_config_formatter/section.md.erb +12 -0
 - data/test/command/test_binlog_reader.rb +362 -0
 - data/test/command/test_ca_generate.rb +70 -0
 - data/test/command/test_cap_ctl.rb +100 -0
 - data/test/command/test_cat.rb +128 -0
 - data/test/command/test_ctl.rb +56 -0
 - data/test/command/test_fluentd.rb +1291 -0
 - data/test/command/test_plugin_config_formatter.rb +397 -0
 - data/test/command/test_plugin_generator.rb +109 -0
 - data/test/compat/test_calls_super.rb +166 -0
 - data/test/compat/test_parser.rb +92 -0
 - data/test/config/assertions.rb +42 -0
 - data/test/config/test_config_parser.rb +551 -0
 - data/test/config/test_configurable.rb +1784 -0
 - data/test/config/test_configure_proxy.rb +604 -0
 - data/test/config/test_dsl.rb +415 -0
 - data/test/config/test_element.rb +518 -0
 - data/test/config/test_literal_parser.rb +309 -0
 - data/test/config/test_plugin_configuration.rb +56 -0
 - data/test/config/test_section.rb +191 -0
 - data/test/config/test_system_config.rb +195 -0
 - data/test/config/test_types.rb +408 -0
 - data/test/counter/test_client.rb +563 -0
 - data/test/counter/test_error.rb +44 -0
 - data/test/counter/test_mutex_hash.rb +179 -0
 - data/test/counter/test_server.rb +589 -0
 - data/test/counter/test_store.rb +258 -0
 - data/test/counter/test_validator.rb +137 -0
 - data/test/helper.rb +155 -0
 - data/test/helpers/fuzzy_assert.rb +89 -0
 - data/test/helpers/process_extenstion.rb +33 -0
 - data/test/log/test_console_adapter.rb +110 -0
 - data/test/plugin/data/2010/01/20100102-030405.log +0 -0
 - data/test/plugin/data/2010/01/20100102-030406.log +0 -0
 - data/test/plugin/data/2010/01/20100102.log +0 -0
 - data/test/plugin/data/log/bar +0 -0
 - data/test/plugin/data/log/foo/bar.log +0 -0
 - data/test/plugin/data/log/foo/bar2 +0 -0
 - data/test/plugin/data/log/test.log +0 -0
 - data/test/plugin/data/sd_file/config +11 -0
 - data/test/plugin/data/sd_file/config.json +17 -0
 - data/test/plugin/data/sd_file/config.yaml +11 -0
 - data/test/plugin/data/sd_file/config.yml +11 -0
 - data/test/plugin/data/sd_file/invalid_config.yml +7 -0
 - data/test/plugin/in_tail/test_fifo.rb +121 -0
 - data/test/plugin/in_tail/test_io_handler.rb +150 -0
 - data/test/plugin/in_tail/test_position_file.rb +346 -0
 - data/test/plugin/out_forward/test_ack_handler.rb +140 -0
 - data/test/plugin/out_forward/test_connection_manager.rb +145 -0
 - data/test/plugin/out_forward/test_handshake_protocol.rb +112 -0
 - data/test/plugin/out_forward/test_load_balancer.rb +106 -0
 - data/test/plugin/out_forward/test_socket_cache.rb +174 -0
 - data/test/plugin/test_bare_output.rb +131 -0
 - data/test/plugin/test_base.rb +247 -0
 - data/test/plugin/test_buf_file.rb +1314 -0
 - data/test/plugin/test_buf_file_single.rb +898 -0
 - data/test/plugin/test_buf_memory.rb +42 -0
 - data/test/plugin/test_buffer.rb +1434 -0
 - data/test/plugin/test_buffer_chunk.rb +209 -0
 - data/test/plugin/test_buffer_file_chunk.rb +871 -0
 - data/test/plugin/test_buffer_file_single_chunk.rb +611 -0
 - data/test/plugin/test_buffer_memory_chunk.rb +339 -0
 - data/test/plugin/test_compressable.rb +87 -0
 - data/test/plugin/test_file_util.rb +96 -0
 - data/test/plugin/test_filter.rb +368 -0
 - data/test/plugin/test_filter_grep.rb +697 -0
 - data/test/plugin/test_filter_parser.rb +731 -0
 - data/test/plugin/test_filter_record_transformer.rb +577 -0
 - data/test/plugin/test_filter_stdout.rb +207 -0
 - data/test/plugin/test_formatter_csv.rb +136 -0
 - data/test/plugin/test_formatter_hash.rb +38 -0
 - data/test/plugin/test_formatter_json.rb +61 -0
 - data/test/plugin/test_formatter_ltsv.rb +70 -0
 - data/test/plugin/test_formatter_msgpack.rb +28 -0
 - data/test/plugin/test_formatter_out_file.rb +116 -0
 - data/test/plugin/test_formatter_single_value.rb +44 -0
 - data/test/plugin/test_formatter_tsv.rb +76 -0
 - data/test/plugin/test_in_debug_agent.rb +49 -0
 - data/test/plugin/test_in_exec.rb +261 -0
 - data/test/plugin/test_in_forward.rb +1178 -0
 - data/test/plugin/test_in_gc_stat.rb +62 -0
 - data/test/plugin/test_in_http.rb +1102 -0
 - data/test/plugin/test_in_monitor_agent.rb +922 -0
 - data/test/plugin/test_in_object_space.rb +66 -0
 - data/test/plugin/test_in_sample.rb +190 -0
 - data/test/plugin/test_in_syslog.rb +505 -0
 - data/test/plugin/test_in_tail.rb +3125 -0
 - data/test/plugin/test_in_tcp.rb +328 -0
 - data/test/plugin/test_in_udp.rb +296 -0
 - data/test/plugin/test_in_unix.rb +181 -0
 - data/test/plugin/test_input.rb +137 -0
 - data/test/plugin/test_metadata.rb +89 -0
 - data/test/plugin/test_metrics.rb +294 -0
 - data/test/plugin/test_metrics_local.rb +96 -0
 - data/test/plugin/test_multi_output.rb +204 -0
 - data/test/plugin/test_out_copy.rb +308 -0
 - data/test/plugin/test_out_exec.rb +312 -0
 - data/test/plugin/test_out_exec_filter.rb +606 -0
 - data/test/plugin/test_out_file.rb +1038 -0
 - data/test/plugin/test_out_forward.rb +1361 -0
 - data/test/plugin/test_out_http.rb +429 -0
 - data/test/plugin/test_out_null.rb +105 -0
 - data/test/plugin/test_out_relabel.rb +28 -0
 - data/test/plugin/test_out_roundrobin.rb +146 -0
 - data/test/plugin/test_out_secondary_file.rb +458 -0
 - data/test/plugin/test_out_stdout.rb +205 -0
 - data/test/plugin/test_out_stream.rb +103 -0
 - data/test/plugin/test_output.rb +1334 -0
 - data/test/plugin/test_output_as_buffered.rb +2024 -0
 - data/test/plugin/test_output_as_buffered_backup.rb +363 -0
 - data/test/plugin/test_output_as_buffered_compress.rb +179 -0
 - data/test/plugin/test_output_as_buffered_overflow.rb +250 -0
 - data/test/plugin/test_output_as_buffered_retries.rb +966 -0
 - data/test/plugin/test_output_as_buffered_secondary.rb +882 -0
 - data/test/plugin/test_output_as_standard.rb +374 -0
 - data/test/plugin/test_owned_by.rb +34 -0
 - data/test/plugin/test_parser.rb +399 -0
 - data/test/plugin/test_parser_apache.rb +42 -0
 - data/test/plugin/test_parser_apache2.rb +47 -0
 - data/test/plugin/test_parser_apache_error.rb +45 -0
 - data/test/plugin/test_parser_csv.rb +200 -0
 - data/test/plugin/test_parser_json.rb +138 -0
 - data/test/plugin/test_parser_labeled_tsv.rb +160 -0
 - data/test/plugin/test_parser_multiline.rb +111 -0
 - data/test/plugin/test_parser_nginx.rb +88 -0
 - data/test/plugin/test_parser_none.rb +52 -0
 - data/test/plugin/test_parser_regexp.rb +284 -0
 - data/test/plugin/test_parser_syslog.rb +650 -0
 - data/test/plugin/test_parser_tsv.rb +122 -0
 - data/test/plugin/test_sd_file.rb +228 -0
 - data/test/plugin/test_sd_srv.rb +230 -0
 - data/test/plugin/test_storage.rb +166 -0
 - data/test/plugin/test_storage_local.rb +335 -0
 - data/test/plugin/test_string_util.rb +26 -0
 - data/test/plugin_helper/data/cert/cert-key.pem +27 -0
 - data/test/plugin_helper/data/cert/cert-with-CRLF.pem +19 -0
 - data/test/plugin_helper/data/cert/cert-with-no-newline.pem +19 -0
 - data/test/plugin_helper/data/cert/cert.pem +19 -0
 - data/test/plugin_helper/data/cert/cert_chains/ca-cert-key.pem +27 -0
 - data/test/plugin_helper/data/cert/cert_chains/ca-cert.pem +20 -0
 - data/test/plugin_helper/data/cert/cert_chains/cert-key.pem +27 -0
 - data/test/plugin_helper/data/cert/cert_chains/cert.pem +40 -0
 - data/test/plugin_helper/data/cert/empty.pem +0 -0
 - data/test/plugin_helper/data/cert/generate_cert.rb +125 -0
 - data/test/plugin_helper/data/cert/with_ca/ca-cert-key-pass.pem +30 -0
 - data/test/plugin_helper/data/cert/with_ca/ca-cert-key.pem +27 -0
 - data/test/plugin_helper/data/cert/with_ca/ca-cert-pass.pem +20 -0
 - data/test/plugin_helper/data/cert/with_ca/ca-cert.pem +20 -0
 - data/test/plugin_helper/data/cert/with_ca/cert-key-pass.pem +30 -0
 - data/test/plugin_helper/data/cert/with_ca/cert-key.pem +27 -0
 - data/test/plugin_helper/data/cert/with_ca/cert-pass.pem +21 -0
 - data/test/plugin_helper/data/cert/with_ca/cert.pem +21 -0
 - data/test/plugin_helper/data/cert/without_ca/cert-key-pass.pem +30 -0
 - data/test/plugin_helper/data/cert/without_ca/cert-key.pem +27 -0
 - data/test/plugin_helper/data/cert/without_ca/cert-pass.pem +20 -0
 - data/test/plugin_helper/data/cert/without_ca/cert.pem +20 -0
 - data/test/plugin_helper/http_server/test_app.rb +65 -0
 - data/test/plugin_helper/http_server/test_route.rb +32 -0
 - data/test/plugin_helper/service_discovery/test_manager.rb +93 -0
 - data/test/plugin_helper/service_discovery/test_round_robin_balancer.rb +21 -0
 - data/test/plugin_helper/test_cert_option.rb +25 -0
 - data/test/plugin_helper/test_child_process.rb +862 -0
 - data/test/plugin_helper/test_compat_parameters.rb +358 -0
 - data/test/plugin_helper/test_event_emitter.rb +80 -0
 - data/test/plugin_helper/test_event_loop.rb +52 -0
 - data/test/plugin_helper/test_extract.rb +194 -0
 - data/test/plugin_helper/test_formatter.rb +255 -0
 - data/test/plugin_helper/test_http_server_helper.rb +372 -0
 - data/test/plugin_helper/test_inject.rb +561 -0
 - data/test/plugin_helper/test_metrics.rb +137 -0
 - data/test/plugin_helper/test_parser.rb +264 -0
 - data/test/plugin_helper/test_record_accessor.rb +238 -0
 - data/test/plugin_helper/test_retry_state.rb +1006 -0
 - data/test/plugin_helper/test_server.rb +1895 -0
 - data/test/plugin_helper/test_service_discovery.rb +165 -0
 - data/test/plugin_helper/test_socket.rb +146 -0
 - data/test/plugin_helper/test_storage.rb +542 -0
 - data/test/plugin_helper/test_thread.rb +164 -0
 - data/test/plugin_helper/test_timer.rb +130 -0
 - data/test/scripts/exec_script.rb +32 -0
 - data/test/scripts/fluent/plugin/formatter1/formatter_test1.rb +7 -0
 - data/test/scripts/fluent/plugin/formatter2/formatter_test2.rb +7 -0
 - data/test/scripts/fluent/plugin/formatter_known.rb +8 -0
 - data/test/scripts/fluent/plugin/out_test.rb +81 -0
 - data/test/scripts/fluent/plugin/out_test2.rb +80 -0
 - data/test/scripts/fluent/plugin/parser_known.rb +4 -0
 - data/test/test_capability.rb +74 -0
 - data/test/test_clock.rb +164 -0
 - data/test/test_config.rb +369 -0
 - data/test/test_configdsl.rb +148 -0
 - data/test/test_daemonizer.rb +91 -0
 - data/test/test_engine.rb +203 -0
 - data/test/test_event.rb +531 -0
 - data/test/test_event_router.rb +348 -0
 - data/test/test_event_time.rb +199 -0
 - data/test/test_file_wrapper.rb +53 -0
 - data/test/test_filter.rb +121 -0
 - data/test/test_fluent_log_event_router.rb +99 -0
 - data/test/test_formatter.rb +369 -0
 - data/test/test_input.rb +31 -0
 - data/test/test_log.rb +1076 -0
 - data/test/test_match.rb +148 -0
 - data/test/test_mixin.rb +351 -0
 - data/test/test_msgpack_factory.rb +50 -0
 - data/test/test_oj_options.rb +55 -0
 - data/test/test_output.rb +278 -0
 - data/test/test_plugin.rb +251 -0
 - data/test/test_plugin_classes.rb +370 -0
 - data/test/test_plugin_helper.rb +81 -0
 - data/test/test_plugin_id.rb +119 -0
 - data/test/test_process.rb +14 -0
 - data/test/test_root_agent.rb +951 -0
 - data/test/test_static_config_analysis.rb +177 -0
 - data/test/test_supervisor.rb +821 -0
 - data/test/test_test_drivers.rb +136 -0
 - data/test/test_time_formatter.rb +301 -0
 - data/test/test_time_parser.rb +362 -0
 - data/test/test_tls.rb +65 -0
 - data/test/test_unique_id.rb +47 -0
 - data/test/test_variable_store.rb +65 -0
 - metadata +1183 -0
 
| 
         @@ -0,0 +1,922 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative '../helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'fluent/test/driver/input'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'fluent/plugin/in_monitor_agent'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'fluent/engine'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'fluent/config'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'fluent/event_router'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'fluent/supervisor'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'net/http'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_relative '../test_plugin_classes'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            class MonitorAgentInputTest < Test::Unit::TestCase
         
     | 
| 
      
 13 
     | 
    
         
            +
              include FuzzyAssert
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              CONFIG_DIR = File.expand_path('../tmp/in_monitor_agent', __dir__)
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 18 
     | 
    
         
            +
                Fluent::Test.setup
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              def create_driver(conf = '')
         
     | 
| 
      
 22 
     | 
    
         
            +
                Fluent::Test::Driver::Input.new(Fluent::Plugin::MonitorAgentInput).configure(conf)
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              def configure_ra(ra, conf_str)
         
     | 
| 
      
 26 
     | 
    
         
            +
                conf = Fluent::Config.parse(conf_str, "(test)", "(test_dir)", true)
         
     | 
| 
      
 27 
     | 
    
         
            +
                ra.configure(conf)
         
     | 
| 
      
 28 
     | 
    
         
            +
                ra
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              def test_configure
         
     | 
| 
      
 32 
     | 
    
         
            +
                d = create_driver
         
     | 
| 
      
 33 
     | 
    
         
            +
                assert_equal("0.0.0.0", d.instance.bind)
         
     | 
| 
      
 34 
     | 
    
         
            +
                assert_equal(24220, d.instance.port)
         
     | 
| 
      
 35 
     | 
    
         
            +
                assert_equal(nil, d.instance.tag)
         
     | 
| 
      
 36 
     | 
    
         
            +
                assert_equal(60, d.instance.emit_interval)
         
     | 
| 
      
 37 
     | 
    
         
            +
                assert_true d.instance.include_config
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              sub_test_case "collect in_monitor_agent plugin statistics" do
         
     | 
| 
      
 41 
     | 
    
         
            +
                # Input Test Driver does not register metric callbacks.
         
     | 
| 
      
 42 
     | 
    
         
            +
                # We should stub them here.
         
     | 
| 
      
 43 
     | 
    
         
            +
                class TestEventMetricRouter < Fluent::Test::Driver::TestEventRouter
         
     | 
| 
      
 44 
     | 
    
         
            +
                  def initialize(driver)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    super
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                    raise ArgumentError, "plugin does not respond metric_callback method" unless @driver.instance.respond_to?(:metric_callback)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  def emit(tag, time, record)
         
     | 
| 
      
 51 
     | 
    
         
            +
                    super
         
     | 
| 
      
 52 
     | 
    
         
            +
                    @driver.instance.metric_callback(OneEventStream.new(time, record))
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                  def emit_array(tag, array)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    super
         
     | 
| 
      
 57 
     | 
    
         
            +
                    @driver.instance.metric_callback(ArrayEventStream.new(array))
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  def emit_stream(tag, es)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    super
         
     | 
| 
      
 62 
     | 
    
         
            +
                    @driver.instance.metric_callback(es)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                class MetricInputDriver < Fluent::Test::Driver::Input
         
     | 
| 
      
 67 
     | 
    
         
            +
                  def configure(conf, syntax: :v1)
         
     | 
| 
      
 68 
     | 
    
         
            +
                    if conf.is_a?(Fluent::Config::Element)
         
     | 
| 
      
 69 
     | 
    
         
            +
                      @config = conf
         
     | 
| 
      
 70 
     | 
    
         
            +
                    else
         
     | 
| 
      
 71 
     | 
    
         
            +
                      @config = Fluent::Config.parse(conf, "(test)", "(test_dir)", syntax: syntax)
         
     | 
| 
      
 72 
     | 
    
         
            +
                    end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                    if @instance.respond_to?(:router=)
         
     | 
| 
      
 75 
     | 
    
         
            +
                      @event_streams = []
         
     | 
| 
      
 76 
     | 
    
         
            +
                      @error_events = []
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                      driver = self
         
     | 
| 
      
 79 
     | 
    
         
            +
                      mojule =  Module.new do
         
     | 
| 
      
 80 
     | 
    
         
            +
                        define_method(:event_emitter_router) do |label_name|
         
     | 
| 
      
 81 
     | 
    
         
            +
                          TestEventMetricRouter.new(driver)
         
     | 
| 
      
 82 
     | 
    
         
            +
                        end
         
     | 
| 
      
 83 
     | 
    
         
            +
                      end
         
     | 
| 
      
 84 
     | 
    
         
            +
                      @instance.singleton_class.prepend mojule
         
     | 
| 
      
 85 
     | 
    
         
            +
                    end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                    @instance.configure(@config)
         
     | 
| 
      
 88 
     | 
    
         
            +
                    self
         
     | 
| 
      
 89 
     | 
    
         
            +
                  end
         
     | 
| 
      
 90 
     | 
    
         
            +
                end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                setup do
         
     | 
| 
      
 93 
     | 
    
         
            +
                  # check @type and type in one configuration
         
     | 
| 
      
 94 
     | 
    
         
            +
                  conf = <<-EOC
         
     | 
| 
      
 95 
     | 
    
         
            +
            <source>
         
     | 
| 
      
 96 
     | 
    
         
            +
              @type test_in_gen
         
     | 
| 
      
 97 
     | 
    
         
            +
              @id test_in_gen
         
     | 
| 
      
 98 
     | 
    
         
            +
              num 10
         
     | 
| 
      
 99 
     | 
    
         
            +
            </source>
         
     | 
| 
      
 100 
     | 
    
         
            +
            <filter>
         
     | 
| 
      
 101 
     | 
    
         
            +
              @type test_filter
         
     | 
| 
      
 102 
     | 
    
         
            +
              @id test_filter
         
     | 
| 
      
 103 
     | 
    
         
            +
            </filter>
         
     | 
| 
      
 104 
     | 
    
         
            +
            <match **>
         
     | 
| 
      
 105 
     | 
    
         
            +
              @type relabel
         
     | 
| 
      
 106 
     | 
    
         
            +
              @id test_relabel
         
     | 
| 
      
 107 
     | 
    
         
            +
              @label @test
         
     | 
| 
      
 108 
     | 
    
         
            +
            </match>
         
     | 
| 
      
 109 
     | 
    
         
            +
            <label @test>
         
     | 
| 
      
 110 
     | 
    
         
            +
              <match **>
         
     | 
| 
      
 111 
     | 
    
         
            +
                @type test_out
         
     | 
| 
      
 112 
     | 
    
         
            +
                @id test_out
         
     | 
| 
      
 113 
     | 
    
         
            +
              </match>
         
     | 
| 
      
 114 
     | 
    
         
            +
            </label>
         
     | 
| 
      
 115 
     | 
    
         
            +
            <label @copy>
         
     | 
| 
      
 116 
     | 
    
         
            +
              <match **>
         
     | 
| 
      
 117 
     | 
    
         
            +
                @type copy
         
     | 
| 
      
 118 
     | 
    
         
            +
                <store>
         
     | 
| 
      
 119 
     | 
    
         
            +
                  @type test_out
         
     | 
| 
      
 120 
     | 
    
         
            +
                  @id copy_out_1
         
     | 
| 
      
 121 
     | 
    
         
            +
                </store>
         
     | 
| 
      
 122 
     | 
    
         
            +
                <store>
         
     | 
| 
      
 123 
     | 
    
         
            +
                  @type test_out
         
     | 
| 
      
 124 
     | 
    
         
            +
                  @id copy_out_2
         
     | 
| 
      
 125 
     | 
    
         
            +
                </store>
         
     | 
| 
      
 126 
     | 
    
         
            +
              </match>
         
     | 
| 
      
 127 
     | 
    
         
            +
            </label>
         
     | 
| 
      
 128 
     | 
    
         
            +
            <label @ERROR>
         
     | 
| 
      
 129 
     | 
    
         
            +
              <match>
         
     | 
| 
      
 130 
     | 
    
         
            +
                @type null
         
     | 
| 
      
 131 
     | 
    
         
            +
                @id null
         
     | 
| 
      
 132 
     | 
    
         
            +
              </match>
         
     | 
| 
      
 133 
     | 
    
         
            +
            </label>
         
     | 
| 
      
 134 
     | 
    
         
            +
            EOC
         
     | 
| 
      
 135 
     | 
    
         
            +
                  @ra = Fluent::RootAgent.new(log: $log)
         
     | 
| 
      
 136 
     | 
    
         
            +
                  stub(Fluent::Engine).root_agent { @ra }
         
     | 
| 
      
 137 
     | 
    
         
            +
                  @ra = configure_ra(@ra, conf)
         
     | 
| 
      
 138 
     | 
    
         
            +
                end
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                data(:with_config_yes => true,
         
     | 
| 
      
 141 
     | 
    
         
            +
                     :with_config_no => false)
         
     | 
| 
      
 142 
     | 
    
         
            +
                def test_enable_input_metrics(with_config)
         
     | 
| 
      
 143 
     | 
    
         
            +
                  monitor_agent_conf = <<-CONF
         
     | 
| 
      
 144 
     | 
    
         
            +
                    tag test.monitor
         
     | 
| 
      
 145 
     | 
    
         
            +
                    emit_interval 1
         
     | 
| 
      
 146 
     | 
    
         
            +
            CONF
         
     | 
| 
      
 147 
     | 
    
         
            +
                  @ra.inputs.first.context_router.emit("test.event", Fluent::Engine.now, {"message":"ok"})
         
     | 
| 
      
 148 
     | 
    
         
            +
                  d = MetricInputDriver.new(Fluent::Plugin::MonitorAgentInput).configure(monitor_agent_conf)
         
     | 
| 
      
 149 
     | 
    
         
            +
                  d.run(expect_emits: 1, timeout: 3)
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
                  test_label = @ra.labels['@test']
         
     | 
| 
      
 152 
     | 
    
         
            +
                  error_label = @ra.labels['@ERROR']
         
     | 
| 
      
 153 
     | 
    
         
            +
                  input_info = {
         
     | 
| 
      
 154 
     | 
    
         
            +
                    "output_plugin"  => false,
         
     | 
| 
      
 155 
     | 
    
         
            +
                    "plugin_category"=> "input",
         
     | 
| 
      
 156 
     | 
    
         
            +
                    "plugin_id"      => "test_in_gen",
         
     | 
| 
      
 157 
     | 
    
         
            +
                    "retry_count"    => nil,
         
     | 
| 
      
 158 
     | 
    
         
            +
                    "type"           => "test_in_gen",
         
     | 
| 
      
 159 
     | 
    
         
            +
                    "emit_records"   => 0, # This field is not updated due to not to be assigned metric callback.
         
     | 
| 
      
 160 
     | 
    
         
            +
                    "emit_size"      => 0, # Ditto.
         
     | 
| 
      
 161 
     | 
    
         
            +
                  }
         
     | 
| 
      
 162 
     | 
    
         
            +
                  input_info.merge!("config" => {"@id" => "test_in_gen", "@type" => "test_in_gen", "num" => "10"}) if with_config
         
     | 
| 
      
 163 
     | 
    
         
            +
                  filter_info = {
         
     | 
| 
      
 164 
     | 
    
         
            +
                    "output_plugin"   => false,
         
     | 
| 
      
 165 
     | 
    
         
            +
                    "plugin_category" => "filter",
         
     | 
| 
      
 166 
     | 
    
         
            +
                    "plugin_id"       => "test_filter",
         
     | 
| 
      
 167 
     | 
    
         
            +
                    "retry_count"     => nil,
         
     | 
| 
      
 168 
     | 
    
         
            +
                    "type"            => "test_filter",
         
     | 
| 
      
 169 
     | 
    
         
            +
                    "emit_records"   => Integer,
         
     | 
| 
      
 170 
     | 
    
         
            +
                    "emit_size"      => Integer,
         
     | 
| 
      
 171 
     | 
    
         
            +
                  }
         
     | 
| 
      
 172 
     | 
    
         
            +
                  filter_info.merge!("config" => {"@id" => "test_filter", "@type" => "test_filter"}) if with_config
         
     | 
| 
      
 173 
     | 
    
         
            +
                  output_info = {
         
     | 
| 
      
 174 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 175 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 176 
     | 
    
         
            +
                    "plugin_id"       => "test_out",
         
     | 
| 
      
 177 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 178 
     | 
    
         
            +
                    "type"            => "test_out",
         
     | 
| 
      
 179 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 180 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 181 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 182 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 183 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 184 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 185 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 186 
     | 
    
         
            +
                  }
         
     | 
| 
      
 187 
     | 
    
         
            +
                  output_info.merge!("config" => {"@id" => "test_out", "@type" => "test_out"}) if with_config
         
     | 
| 
      
 188 
     | 
    
         
            +
                  error_label_info = {
         
     | 
| 
      
 189 
     | 
    
         
            +
                    "buffer_queue_length" => 0,
         
     | 
| 
      
 190 
     | 
    
         
            +
                    "buffer_timekeys" => [],
         
     | 
| 
      
 191 
     | 
    
         
            +
                    "buffer_total_queued_size" => 0,
         
     | 
| 
      
 192 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 193 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 194 
     | 
    
         
            +
                    "plugin_id"       => "null",
         
     | 
| 
      
 195 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 196 
     | 
    
         
            +
                    "type"            => "null",
         
     | 
| 
      
 197 
     | 
    
         
            +
                    "buffer_available_buffer_space_ratios" => Float,
         
     | 
| 
      
 198 
     | 
    
         
            +
                    "buffer_queue_byte_size" => Integer,
         
     | 
| 
      
 199 
     | 
    
         
            +
                    "buffer_stage_byte_size" => Integer,
         
     | 
| 
      
 200 
     | 
    
         
            +
                    "buffer_stage_length" => Integer,
         
     | 
| 
      
 201 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 202 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 203 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 204 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 205 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 206 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 207 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 208 
     | 
    
         
            +
                  }
         
     | 
| 
      
 209 
     | 
    
         
            +
                  error_label_info.merge!("config" => {"@id"=>"null", "@type" => "null"}) if with_config
         
     | 
| 
      
 210 
     | 
    
         
            +
                  opts = {with_config: with_config}
         
     | 
| 
      
 211 
     | 
    
         
            +
                  assert_equal(input_info, d.instance.get_monitor_info(@ra.inputs.first, opts))
         
     | 
| 
      
 212 
     | 
    
         
            +
                  assert_fuzzy_equal(filter_info, d.instance.get_monitor_info(@ra.filters.first, opts))
         
     | 
| 
      
 213 
     | 
    
         
            +
                  assert_fuzzy_equal(output_info, d.instance.get_monitor_info(test_label.outputs.first, opts))
         
     | 
| 
      
 214 
     | 
    
         
            +
                  assert_fuzzy_equal(error_label_info, d.instance.get_monitor_info(error_label.outputs.first, opts))
         
     | 
| 
      
 215 
     | 
    
         
            +
                  monitor_agent_emit_info = {
         
     | 
| 
      
 216 
     | 
    
         
            +
                    "emit_records" => Integer,
         
     | 
| 
      
 217 
     | 
    
         
            +
                    "emit_size" => Integer,
         
     | 
| 
      
 218 
     | 
    
         
            +
                  }
         
     | 
| 
      
 219 
     | 
    
         
            +
                  filter_statistics_info = {
         
     | 
| 
      
 220 
     | 
    
         
            +
                    "emit_records" => Integer,
         
     | 
| 
      
 221 
     | 
    
         
            +
                    "emit_size" => Integer,
         
     | 
| 
      
 222 
     | 
    
         
            +
                  }
         
     | 
| 
      
 223 
     | 
    
         
            +
                  assert_fuzzy_equal(monitor_agent_emit_info, d.instance.statistics["input"])
         
     | 
| 
      
 224 
     | 
    
         
            +
                  assert_fuzzy_equal(filter_statistics_info, @ra.filters.first.statistics["filter"])
         
     | 
| 
      
 225 
     | 
    
         
            +
                end
         
     | 
| 
      
 226 
     | 
    
         
            +
              end
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
      
 228 
     | 
    
         
            +
              sub_test_case "collect plugin information" do
         
     | 
| 
      
 229 
     | 
    
         
            +
                setup do
         
     | 
| 
      
 230 
     | 
    
         
            +
                  # check @type and type in one configuration
         
     | 
| 
      
 231 
     | 
    
         
            +
                  conf = <<-EOC
         
     | 
| 
      
 232 
     | 
    
         
            +
            <source>
         
     | 
| 
      
 233 
     | 
    
         
            +
              @type test_in
         
     | 
| 
      
 234 
     | 
    
         
            +
              @id test_in
         
     | 
| 
      
 235 
     | 
    
         
            +
            </source>
         
     | 
| 
      
 236 
     | 
    
         
            +
            <filter>
         
     | 
| 
      
 237 
     | 
    
         
            +
              @type test_filter
         
     | 
| 
      
 238 
     | 
    
         
            +
              @id test_filter
         
     | 
| 
      
 239 
     | 
    
         
            +
            </filter>
         
     | 
| 
      
 240 
     | 
    
         
            +
            <match **>
         
     | 
| 
      
 241 
     | 
    
         
            +
              @type relabel
         
     | 
| 
      
 242 
     | 
    
         
            +
              @id test_relabel
         
     | 
| 
      
 243 
     | 
    
         
            +
              @label @test
         
     | 
| 
      
 244 
     | 
    
         
            +
            </match>
         
     | 
| 
      
 245 
     | 
    
         
            +
            <label @test>
         
     | 
| 
      
 246 
     | 
    
         
            +
              <match **>
         
     | 
| 
      
 247 
     | 
    
         
            +
                @type test_out
         
     | 
| 
      
 248 
     | 
    
         
            +
                @id test_out
         
     | 
| 
      
 249 
     | 
    
         
            +
              </match>
         
     | 
| 
      
 250 
     | 
    
         
            +
            </label>
         
     | 
| 
      
 251 
     | 
    
         
            +
            <label @copy>
         
     | 
| 
      
 252 
     | 
    
         
            +
              <match **>
         
     | 
| 
      
 253 
     | 
    
         
            +
                @type copy
         
     | 
| 
      
 254 
     | 
    
         
            +
                <store>
         
     | 
| 
      
 255 
     | 
    
         
            +
                  @type test_out
         
     | 
| 
      
 256 
     | 
    
         
            +
                  @id copy_out_1
         
     | 
| 
      
 257 
     | 
    
         
            +
                </store>
         
     | 
| 
      
 258 
     | 
    
         
            +
                <store>
         
     | 
| 
      
 259 
     | 
    
         
            +
                  @type test_out
         
     | 
| 
      
 260 
     | 
    
         
            +
                  @id copy_out_2
         
     | 
| 
      
 261 
     | 
    
         
            +
                </store>
         
     | 
| 
      
 262 
     | 
    
         
            +
              </match>
         
     | 
| 
      
 263 
     | 
    
         
            +
            </label>
         
     | 
| 
      
 264 
     | 
    
         
            +
            <label @ERROR>
         
     | 
| 
      
 265 
     | 
    
         
            +
              <match>
         
     | 
| 
      
 266 
     | 
    
         
            +
                @type null
         
     | 
| 
      
 267 
     | 
    
         
            +
                @id null
         
     | 
| 
      
 268 
     | 
    
         
            +
              </match>
         
     | 
| 
      
 269 
     | 
    
         
            +
            </label>
         
     | 
| 
      
 270 
     | 
    
         
            +
            EOC
         
     | 
| 
      
 271 
     | 
    
         
            +
                  @ra = Fluent::RootAgent.new(log: $log)
         
     | 
| 
      
 272 
     | 
    
         
            +
                  stub(Fluent::Engine).root_agent { @ra }
         
     | 
| 
      
 273 
     | 
    
         
            +
                  @ra = configure_ra(@ra, conf)
         
     | 
| 
      
 274 
     | 
    
         
            +
                end
         
     | 
| 
      
 275 
     | 
    
         
            +
             
     | 
| 
      
 276 
     | 
    
         
            +
                test "plugin_category" do
         
     | 
| 
      
 277 
     | 
    
         
            +
                  d = create_driver
         
     | 
| 
      
 278 
     | 
    
         
            +
                  test_label = @ra.labels['@test']
         
     | 
| 
      
 279 
     | 
    
         
            +
                  error_label = @ra.labels['@ERROR']
         
     | 
| 
      
 280 
     | 
    
         
            +
                  assert_equal("input", d.instance.plugin_category(@ra.inputs.first))
         
     | 
| 
      
 281 
     | 
    
         
            +
                  assert_equal("filter", d.instance.plugin_category(@ra.filters.first))
         
     | 
| 
      
 282 
     | 
    
         
            +
                  assert_equal("output", d.instance.plugin_category(test_label.outputs.first))
         
     | 
| 
      
 283 
     | 
    
         
            +
                  assert_equal("output", d.instance.plugin_category(error_label.outputs.first))
         
     | 
| 
      
 284 
     | 
    
         
            +
                end
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
                data(:with_config_yes => true,
         
     | 
| 
      
 287 
     | 
    
         
            +
                     :with_config_no => false)
         
     | 
| 
      
 288 
     | 
    
         
            +
                test "get_monitor_info" do |with_config|
         
     | 
| 
      
 289 
     | 
    
         
            +
                  d = create_driver
         
     | 
| 
      
 290 
     | 
    
         
            +
                  test_label = @ra.labels['@test']
         
     | 
| 
      
 291 
     | 
    
         
            +
                  error_label = @ra.labels['@ERROR']
         
     | 
| 
      
 292 
     | 
    
         
            +
                  input_info = {
         
     | 
| 
      
 293 
     | 
    
         
            +
                    "output_plugin"  => false,
         
     | 
| 
      
 294 
     | 
    
         
            +
                    "plugin_category"=> "input",
         
     | 
| 
      
 295 
     | 
    
         
            +
                    "plugin_id"      => "test_in",
         
     | 
| 
      
 296 
     | 
    
         
            +
                    "retry_count"    => nil,
         
     | 
| 
      
 297 
     | 
    
         
            +
                    "type"           => "test_in",
         
     | 
| 
      
 298 
     | 
    
         
            +
                    "emit_records"   => 0,
         
     | 
| 
      
 299 
     | 
    
         
            +
                    "emit_size"      => 0,
         
     | 
| 
      
 300 
     | 
    
         
            +
                  }
         
     | 
| 
      
 301 
     | 
    
         
            +
                  input_info.merge!("config" => {"@id" => "test_in", "@type" => "test_in"}) if with_config
         
     | 
| 
      
 302 
     | 
    
         
            +
                  filter_info = {
         
     | 
| 
      
 303 
     | 
    
         
            +
                    "output_plugin"   => false,
         
     | 
| 
      
 304 
     | 
    
         
            +
                    "plugin_category" => "filter",
         
     | 
| 
      
 305 
     | 
    
         
            +
                    "plugin_id"       => "test_filter",
         
     | 
| 
      
 306 
     | 
    
         
            +
                    "retry_count"     => nil,
         
     | 
| 
      
 307 
     | 
    
         
            +
                    "type"            => "test_filter",
         
     | 
| 
      
 308 
     | 
    
         
            +
                    "emit_records"   => 0,
         
     | 
| 
      
 309 
     | 
    
         
            +
                    "emit_size"      => 0,
         
     | 
| 
      
 310 
     | 
    
         
            +
                  }
         
     | 
| 
      
 311 
     | 
    
         
            +
                  filter_info.merge!("config" => {"@id" => "test_filter", "@type" => "test_filter"}) if with_config
         
     | 
| 
      
 312 
     | 
    
         
            +
                  output_info = {
         
     | 
| 
      
 313 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 314 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 315 
     | 
    
         
            +
                    "plugin_id"       => "test_out",
         
     | 
| 
      
 316 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 317 
     | 
    
         
            +
                    "type"            => "test_out",
         
     | 
| 
      
 318 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 319 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 320 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 321 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 322 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 323 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 324 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 325 
     | 
    
         
            +
                  }
         
     | 
| 
      
 326 
     | 
    
         
            +
                  output_info.merge!("config" => {"@id" => "test_out", "@type" => "test_out"}) if with_config
         
     | 
| 
      
 327 
     | 
    
         
            +
                  error_label_info = {
         
     | 
| 
      
 328 
     | 
    
         
            +
                    "buffer_queue_length" => 0,
         
     | 
| 
      
 329 
     | 
    
         
            +
                    "buffer_timekeys" => [],
         
     | 
| 
      
 330 
     | 
    
         
            +
                    "buffer_total_queued_size" => 0,
         
     | 
| 
      
 331 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 332 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 333 
     | 
    
         
            +
                    "plugin_id"       => "null",
         
     | 
| 
      
 334 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 335 
     | 
    
         
            +
                    "type"            => "null",
         
     | 
| 
      
 336 
     | 
    
         
            +
                    "buffer_available_buffer_space_ratios" => Float,
         
     | 
| 
      
 337 
     | 
    
         
            +
                    "buffer_queue_byte_size" => Integer,
         
     | 
| 
      
 338 
     | 
    
         
            +
                    "buffer_stage_byte_size" => Integer,
         
     | 
| 
      
 339 
     | 
    
         
            +
                    "buffer_stage_length" => Integer,
         
     | 
| 
      
 340 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 341 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 342 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 343 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 344 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 345 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 346 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 347 
     | 
    
         
            +
                  }
         
     | 
| 
      
 348 
     | 
    
         
            +
                  error_label_info.merge!("config" => {"@id"=>"null", "@type" => "null"}) if with_config
         
     | 
| 
      
 349 
     | 
    
         
            +
                  opts = {with_config: with_config}
         
     | 
| 
      
 350 
     | 
    
         
            +
                  assert_equal(input_info, d.instance.get_monitor_info(@ra.inputs.first, opts))
         
     | 
| 
      
 351 
     | 
    
         
            +
                  assert_fuzzy_equal(filter_info, d.instance.get_monitor_info(@ra.filters.first, opts))
         
     | 
| 
      
 352 
     | 
    
         
            +
                  assert_fuzzy_equal(output_info, d.instance.get_monitor_info(test_label.outputs.first, opts))
         
     | 
| 
      
 353 
     | 
    
         
            +
                  assert_fuzzy_equal(error_label_info, d.instance.get_monitor_info(error_label.outputs.first, opts))
         
     | 
| 
      
 354 
     | 
    
         
            +
                end
         
     | 
| 
      
 355 
     | 
    
         
            +
             
     | 
| 
      
 356 
     | 
    
         
            +
                test "fluentd opts" do
         
     | 
| 
      
 357 
     | 
    
         
            +
                  d = create_driver
         
     | 
| 
      
 358 
     | 
    
         
            +
             
     | 
| 
      
 359 
     | 
    
         
            +
                  filepath = nil
         
     | 
| 
      
 360 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 361 
     | 
    
         
            +
                    FileUtils.mkdir_p(CONFIG_DIR)
         
     | 
| 
      
 362 
     | 
    
         
            +
                    filepath = File.expand_path('fluentd.conf', CONFIG_DIR)
         
     | 
| 
      
 363 
     | 
    
         
            +
                    FileUtils.touch(filepath)
         
     | 
| 
      
 364 
     | 
    
         
            +
                    s = Fluent::Supervisor.new({config_path: filepath})
         
     | 
| 
      
 365 
     | 
    
         
            +
                    s.configure
         
     | 
| 
      
 366 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 367 
     | 
    
         
            +
                    FileUtils.rm_r(CONFIG_DIR) rescue _
         
     | 
| 
      
 368 
     | 
    
         
            +
                  end
         
     | 
| 
      
 369 
     | 
    
         
            +
             
     | 
| 
      
 370 
     | 
    
         
            +
                  expected_opts = {
         
     | 
| 
      
 371 
     | 
    
         
            +
                    "config_path" => filepath,
         
     | 
| 
      
 372 
     | 
    
         
            +
                    "pid_file"    => nil,
         
     | 
| 
      
 373 
     | 
    
         
            +
                    "plugin_dirs" => ["/etc/fluent/plugin"],
         
     | 
| 
      
 374 
     | 
    
         
            +
                    "log_path"    => nil,
         
     | 
| 
      
 375 
     | 
    
         
            +
                    "root_dir"    => nil,
         
     | 
| 
      
 376 
     | 
    
         
            +
                  }
         
     | 
| 
      
 377 
     | 
    
         
            +
                  assert_equal(expected_opts, d.instance.fluentd_opts)
         
     | 
| 
      
 378 
     | 
    
         
            +
                end
         
     | 
| 
      
 379 
     | 
    
         
            +
             
     | 
| 
      
 380 
     | 
    
         
            +
                test "all_plugins" do
         
     | 
| 
      
 381 
     | 
    
         
            +
                  d = create_driver
         
     | 
| 
      
 382 
     | 
    
         
            +
                  plugins = []
         
     | 
| 
      
 383 
     | 
    
         
            +
                  d.instance.all_plugins.each {|plugin| plugins << plugin.class }
         
     | 
| 
      
 384 
     | 
    
         
            +
                  assert_equal([FluentTest::FluentTestInput,
         
     | 
| 
      
 385 
     | 
    
         
            +
                                Fluent::Plugin::RelabelOutput,
         
     | 
| 
      
 386 
     | 
    
         
            +
                                FluentTest::FluentTestFilter,
         
     | 
| 
      
 387 
     | 
    
         
            +
                                FluentTest::FluentTestOutput, # in label @test
         
     | 
| 
      
 388 
     | 
    
         
            +
                                Fluent::Plugin::CopyOutput,
         
     | 
| 
      
 389 
     | 
    
         
            +
                                FluentTest::FluentTestOutput, # in label @copy 1
         
     | 
| 
      
 390 
     | 
    
         
            +
                                FluentTest::FluentTestOutput, # in label @copy 2
         
     | 
| 
      
 391 
     | 
    
         
            +
                                Fluent::Plugin::NullOutput], plugins)
         
     | 
| 
      
 392 
     | 
    
         
            +
                end
         
     | 
| 
      
 393 
     | 
    
         
            +
             
     | 
| 
      
 394 
     | 
    
         
            +
                test "emit" do
         
     | 
| 
      
 395 
     | 
    
         
            +
                  port = unused_port
         
     | 
| 
      
 396 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 397 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 398 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 399 
     | 
    
         
            +
              port #{port}
         
     | 
| 
      
 400 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 401 
     | 
    
         
            +
              emit_interval 1
         
     | 
| 
      
 402 
     | 
    
         
            +
            ")
         
     | 
| 
      
 403 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 404 
     | 
    
         
            +
                  d.end_if do
         
     | 
| 
      
 405 
     | 
    
         
            +
                    d.events.size >= 5
         
     | 
| 
      
 406 
     | 
    
         
            +
                  end
         
     | 
| 
      
 407 
     | 
    
         
            +
                  d.run
         
     | 
| 
      
 408 
     | 
    
         
            +
                  expect_relabel_record = {
         
     | 
| 
      
 409 
     | 
    
         
            +
                    "plugin_id"       => "test_relabel",
         
     | 
| 
      
 410 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 411 
     | 
    
         
            +
                    "type"            => "relabel",
         
     | 
| 
      
 412 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 413 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 414 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 415 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 416 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 417 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 418 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 419 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 420 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 421 
     | 
    
         
            +
                  }
         
     | 
| 
      
 422 
     | 
    
         
            +
                  expect_test_out_record = {
         
     | 
| 
      
 423 
     | 
    
         
            +
                    "plugin_id"       => "test_out",
         
     | 
| 
      
 424 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 425 
     | 
    
         
            +
                    "type"            => "test_out",
         
     | 
| 
      
 426 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 427 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 428 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 429 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 430 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 431 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 432 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 433 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 434 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 435 
     | 
    
         
            +
                  }
         
     | 
| 
      
 436 
     | 
    
         
            +
                  assert_fuzzy_equal(expect_relabel_record, d.events[1][2])
         
     | 
| 
      
 437 
     | 
    
         
            +
                  assert_fuzzy_equal(expect_test_out_record, d.events[3][2])
         
     | 
| 
      
 438 
     | 
    
         
            +
                end
         
     | 
| 
      
 439 
     | 
    
         
            +
              end
         
     | 
| 
      
 440 
     | 
    
         
            +
             
     | 
| 
      
 441 
     | 
    
         
            +
              def get(uri, header = {})
         
     | 
| 
      
 442 
     | 
    
         
            +
                url = URI.parse(uri)
         
     | 
| 
      
 443 
     | 
    
         
            +
                req = Net::HTTP::Get.new(url, header)
         
     | 
| 
      
 444 
     | 
    
         
            +
                unless header.has_key?('Content-Type')
         
     | 
| 
      
 445 
     | 
    
         
            +
                  header['Content-Type'] = 'application/octet-stream'
         
     | 
| 
      
 446 
     | 
    
         
            +
                end
         
     | 
| 
      
 447 
     | 
    
         
            +
                Net::HTTP.start(url.host, url.port) {|http|
         
     | 
| 
      
 448 
     | 
    
         
            +
                  http.request(req)
         
     | 
| 
      
 449 
     | 
    
         
            +
                }
         
     | 
| 
      
 450 
     | 
    
         
            +
              end
         
     | 
| 
      
 451 
     | 
    
         
            +
             
     | 
| 
      
 452 
     | 
    
         
            +
              sub_test_case "servlets" do
         
     | 
| 
      
 453 
     | 
    
         
            +
                setup do
         
     | 
| 
      
 454 
     | 
    
         
            +
                  @port = unused_port
         
     | 
| 
      
 455 
     | 
    
         
            +
                  # check @type and type in one configuration
         
     | 
| 
      
 456 
     | 
    
         
            +
                  conf = <<-EOC
         
     | 
| 
      
 457 
     | 
    
         
            +
            <source>
         
     | 
| 
      
 458 
     | 
    
         
            +
              @type test_in
         
     | 
| 
      
 459 
     | 
    
         
            +
              @id test_in
         
     | 
| 
      
 460 
     | 
    
         
            +
            </source>
         
     | 
| 
      
 461 
     | 
    
         
            +
            <source>
         
     | 
| 
      
 462 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 463 
     | 
    
         
            +
              bind "127.0.0.1"
         
     | 
| 
      
 464 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 465 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 466 
     | 
    
         
            +
              @id monitor_agent
         
     | 
| 
      
 467 
     | 
    
         
            +
            </source>
         
     | 
| 
      
 468 
     | 
    
         
            +
            <filter>
         
     | 
| 
      
 469 
     | 
    
         
            +
              @type test_filter
         
     | 
| 
      
 470 
     | 
    
         
            +
              @id test_filter
         
     | 
| 
      
 471 
     | 
    
         
            +
            </filter>
         
     | 
| 
      
 472 
     | 
    
         
            +
            <match **>
         
     | 
| 
      
 473 
     | 
    
         
            +
              @type relabel
         
     | 
| 
      
 474 
     | 
    
         
            +
              @id test_relabel
         
     | 
| 
      
 475 
     | 
    
         
            +
              @label @test
         
     | 
| 
      
 476 
     | 
    
         
            +
            </match>
         
     | 
| 
      
 477 
     | 
    
         
            +
            <label @test>
         
     | 
| 
      
 478 
     | 
    
         
            +
              <match **>
         
     | 
| 
      
 479 
     | 
    
         
            +
                @type test_out
         
     | 
| 
      
 480 
     | 
    
         
            +
                @id test_out
         
     | 
| 
      
 481 
     | 
    
         
            +
              </match>
         
     | 
| 
      
 482 
     | 
    
         
            +
            </label>
         
     | 
| 
      
 483 
     | 
    
         
            +
            <label @ERROR>
         
     | 
| 
      
 484 
     | 
    
         
            +
              <match>
         
     | 
| 
      
 485 
     | 
    
         
            +
                @type null
         
     | 
| 
      
 486 
     | 
    
         
            +
                @id null
         
     | 
| 
      
 487 
     | 
    
         
            +
              </match>
         
     | 
| 
      
 488 
     | 
    
         
            +
            </label>
         
     | 
| 
      
 489 
     | 
    
         
            +
            EOC
         
     | 
| 
      
 490 
     | 
    
         
            +
             
     | 
| 
      
 491 
     | 
    
         
            +
             
     | 
| 
      
 492 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 493 
     | 
    
         
            +
                    @ra = Fluent::RootAgent.new(log: $log)
         
     | 
| 
      
 494 
     | 
    
         
            +
                    stub(Fluent::Engine).root_agent { @ra }
         
     | 
| 
      
 495 
     | 
    
         
            +
                    @ra = configure_ra(@ra, conf)
         
     | 
| 
      
 496 
     | 
    
         
            +
                    # store Supervisor instance to avoid collected by GC
         
     | 
| 
      
 497 
     | 
    
         
            +
             
     | 
| 
      
 498 
     | 
    
         
            +
                    FileUtils.mkdir_p(CONFIG_DIR)
         
     | 
| 
      
 499 
     | 
    
         
            +
                    @filepath = File.expand_path('fluentd.conf', CONFIG_DIR)
         
     | 
| 
      
 500 
     | 
    
         
            +
                    File.open(@filepath, 'w') do |v|
         
     | 
| 
      
 501 
     | 
    
         
            +
                      v.puts(conf)
         
     | 
| 
      
 502 
     | 
    
         
            +
                    end
         
     | 
| 
      
 503 
     | 
    
         
            +
             
     | 
| 
      
 504 
     | 
    
         
            +
                    @supervisor = Fluent::Supervisor.new({config_path: @filepath})
         
     | 
| 
      
 505 
     | 
    
         
            +
                    @supervisor.configure
         
     | 
| 
      
 506 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 507 
     | 
    
         
            +
                    FileUtils.rm_r(CONFIG_DIR) rescue _
         
     | 
| 
      
 508 
     | 
    
         
            +
                  end
         
     | 
| 
      
 509 
     | 
    
         
            +
                end
         
     | 
| 
      
 510 
     | 
    
         
            +
             
     | 
| 
      
 511 
     | 
    
         
            +
                test "/api/plugins" do
         
     | 
| 
      
 512 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 513 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 514 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 515 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 516 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 517 
     | 
    
         
            +
            ")
         
     | 
| 
      
 518 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 519 
     | 
    
         
            +
                  expected_test_in_response = "\
         
     | 
| 
      
 520 
     | 
    
         
            +
            plugin_id:test_in\tplugin_category:input\ttype:test_in\toutput_plugin:false\tretry_count:\temit_records:0\temit_size:0"
         
     | 
| 
      
 521 
     | 
    
         
            +
                  expected_test_filter_response = "\
         
     | 
| 
      
 522 
     | 
    
         
            +
            plugin_id:test_filter\tplugin_category:filter\ttype:test_filter\toutput_plugin:false\tretry_count:\temit_records:0\temit_size:0"
         
     | 
| 
      
 523 
     | 
    
         
            +
             
     | 
| 
      
 524 
     | 
    
         
            +
                  response = get("http://127.0.0.1:#{@port}/api/plugins").body
         
     | 
| 
      
 525 
     | 
    
         
            +
                  test_in = response.split("\n")[0]
         
     | 
| 
      
 526 
     | 
    
         
            +
                  test_filter = response.split("\n")[3]
         
     | 
| 
      
 527 
     | 
    
         
            +
                  assert_equal(expected_test_in_response, test_in)
         
     | 
| 
      
 528 
     | 
    
         
            +
                  assert_equal(expected_test_filter_response, test_filter)
         
     | 
| 
      
 529 
     | 
    
         
            +
                end
         
     | 
| 
      
 530 
     | 
    
         
            +
             
     | 
| 
      
 531 
     | 
    
         
            +
                data(:include_config_and_retry_yes => [true, true, "include_config yes", "include_retry yes"],
         
     | 
| 
      
 532 
     | 
    
         
            +
                     :include_config_and_retry_no => [false, false, "include_config no", "include_retry no"],)
         
     | 
| 
      
 533 
     | 
    
         
            +
                test "/api/plugins.json" do |(with_config, with_retry, include_conf, retry_conf)|
         
     | 
| 
      
 534 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 535 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 536 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 537 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 538 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 539 
     | 
    
         
            +
              #{include_conf}
         
     | 
| 
      
 540 
     | 
    
         
            +
              #{retry_conf}
         
     | 
| 
      
 541 
     | 
    
         
            +
            ")
         
     | 
| 
      
 542 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 543 
     | 
    
         
            +
                  expected_test_in_response = {
         
     | 
| 
      
 544 
     | 
    
         
            +
                    "output_plugin"   => false,
         
     | 
| 
      
 545 
     | 
    
         
            +
                    "plugin_category" => "input",
         
     | 
| 
      
 546 
     | 
    
         
            +
                    "plugin_id"       => "test_in",
         
     | 
| 
      
 547 
     | 
    
         
            +
                    "retry_count"     => nil,
         
     | 
| 
      
 548 
     | 
    
         
            +
                    "type"            => "test_in",
         
     | 
| 
      
 549 
     | 
    
         
            +
                    "emit_records"    => 0,
         
     | 
| 
      
 550 
     | 
    
         
            +
                    "emit_size"       => 0,
         
     | 
| 
      
 551 
     | 
    
         
            +
                  }
         
     | 
| 
      
 552 
     | 
    
         
            +
                  expected_test_in_response.merge!("config" => {"@id" => "test_in", "@type" => "test_in"}) if with_config
         
     | 
| 
      
 553 
     | 
    
         
            +
                  expected_null_response = {
         
     | 
| 
      
 554 
     | 
    
         
            +
                    "buffer_queue_length" => 0,
         
     | 
| 
      
 555 
     | 
    
         
            +
                    "buffer_timekeys" => [],
         
     | 
| 
      
 556 
     | 
    
         
            +
                    "buffer_total_queued_size" => 0,
         
     | 
| 
      
 557 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 558 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 559 
     | 
    
         
            +
                    "plugin_id"       => "null",
         
     | 
| 
      
 560 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 561 
     | 
    
         
            +
                    "type"            => "null",
         
     | 
| 
      
 562 
     | 
    
         
            +
                    "buffer_available_buffer_space_ratios" => Float,
         
     | 
| 
      
 563 
     | 
    
         
            +
                    "buffer_queue_byte_size" => Integer,
         
     | 
| 
      
 564 
     | 
    
         
            +
                    "buffer_stage_byte_size" => Integer,
         
     | 
| 
      
 565 
     | 
    
         
            +
                    "buffer_stage_length" => Integer,
         
     | 
| 
      
 566 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 567 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 568 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 569 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 570 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 571 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 572 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 573 
     | 
    
         
            +
                  }
         
     | 
| 
      
 574 
     | 
    
         
            +
                  expected_null_response.merge!("config" => {"@id" => "null", "@type" => "null"}) if with_config
         
     | 
| 
      
 575 
     | 
    
         
            +
                  expected_null_response.merge!("retry" => {}) if with_retry
         
     | 
| 
      
 576 
     | 
    
         
            +
                  response = JSON.parse(get("http://127.0.0.1:#{@port}/api/plugins.json").body)
         
     | 
| 
      
 577 
     | 
    
         
            +
                  test_in_response = response["plugins"][0]
         
     | 
| 
      
 578 
     | 
    
         
            +
                  null_response = response["plugins"][5]
         
     | 
| 
      
 579 
     | 
    
         
            +
                  assert_equal(expected_test_in_response, test_in_response)
         
     | 
| 
      
 580 
     | 
    
         
            +
                  assert_fuzzy_equal(expected_null_response, null_response)
         
     | 
| 
      
 581 
     | 
    
         
            +
                end
         
     | 
| 
      
 582 
     | 
    
         
            +
             
     | 
| 
      
 583 
     | 
    
         
            +
                test "/api/plugins.json/not_found" do
         
     | 
| 
      
 584 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 585 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 586 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 587 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 588 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 589 
     | 
    
         
            +
            ")
         
     | 
| 
      
 590 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 591 
     | 
    
         
            +
                  resp = get("http://127.0.0.1:#{@port}/api/plugins.json/not_found")
         
     | 
| 
      
 592 
     | 
    
         
            +
                  assert_equal('404', resp.code)
         
     | 
| 
      
 593 
     | 
    
         
            +
                  body = JSON.parse(resp.body)
         
     | 
| 
      
 594 
     | 
    
         
            +
                  assert_equal(body['message'], 'Not found')
         
     | 
| 
      
 595 
     | 
    
         
            +
                end
         
     | 
| 
      
 596 
     | 
    
         
            +
             
     | 
| 
      
 597 
     | 
    
         
            +
                data(:with_config_and_retry_yes => [true, true, "?with_config=yes&with_retry"],
         
     | 
| 
      
 598 
     | 
    
         
            +
                     :with_config_and_retry_no => [false, false, "?with_config=no&with_retry=no"])
         
     | 
| 
      
 599 
     | 
    
         
            +
                test "/api/plugins.json with query parameter. query parameter is preferred than include_config" do |(with_config, with_retry, query_param)|
         
     | 
| 
      
 600 
     | 
    
         
            +
             
     | 
| 
      
 601 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 602 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 603 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 604 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 605 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 606 
     | 
    
         
            +
            ")
         
     | 
| 
      
 607 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 608 
     | 
    
         
            +
                  expected_test_in_response = {
         
     | 
| 
      
 609 
     | 
    
         
            +
                    "output_plugin"   => false,
         
     | 
| 
      
 610 
     | 
    
         
            +
                    "plugin_category" => "input",
         
     | 
| 
      
 611 
     | 
    
         
            +
                    "plugin_id"       => "test_in",
         
     | 
| 
      
 612 
     | 
    
         
            +
                    "retry_count"     => nil,
         
     | 
| 
      
 613 
     | 
    
         
            +
                    "type"            => "test_in",
         
     | 
| 
      
 614 
     | 
    
         
            +
                    "emit_records"   => 0,
         
     | 
| 
      
 615 
     | 
    
         
            +
                    "emit_size"      => 0,
         
     | 
| 
      
 616 
     | 
    
         
            +
                  }
         
     | 
| 
      
 617 
     | 
    
         
            +
                  expected_test_in_response.merge!("config" => {"@id" => "test_in", "@type" => "test_in"}) if with_config
         
     | 
| 
      
 618 
     | 
    
         
            +
                  expected_null_response = {
         
     | 
| 
      
 619 
     | 
    
         
            +
                    "buffer_queue_length" => 0,
         
     | 
| 
      
 620 
     | 
    
         
            +
                    "buffer_timekeys" => [],
         
     | 
| 
      
 621 
     | 
    
         
            +
                    "buffer_total_queued_size" => 0,
         
     | 
| 
      
 622 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 623 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 624 
     | 
    
         
            +
                    "plugin_id"       => "null",
         
     | 
| 
      
 625 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 626 
     | 
    
         
            +
                    "type"            => "null",
         
     | 
| 
      
 627 
     | 
    
         
            +
                    "buffer_available_buffer_space_ratios" => Float,
         
     | 
| 
      
 628 
     | 
    
         
            +
                    "buffer_queue_byte_size" => Integer,
         
     | 
| 
      
 629 
     | 
    
         
            +
                    "buffer_stage_byte_size" => Integer,
         
     | 
| 
      
 630 
     | 
    
         
            +
                    "buffer_stage_length" => Integer,
         
     | 
| 
      
 631 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 632 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 633 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 634 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 635 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 636 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 637 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 638 
     | 
    
         
            +
                  }
         
     | 
| 
      
 639 
     | 
    
         
            +
                  expected_null_response.merge!("config" => {"@id" => "null", "@type" => "null"}) if with_config
         
     | 
| 
      
 640 
     | 
    
         
            +
                  expected_null_response.merge!("retry" => {}) if with_retry
         
     | 
| 
      
 641 
     | 
    
         
            +
                  response = JSON.parse(get("http://127.0.0.1:#{@port}/api/plugins.json#{query_param}").body)
         
     | 
| 
      
 642 
     | 
    
         
            +
                  test_in_response = response["plugins"][0]
         
     | 
| 
      
 643 
     | 
    
         
            +
                  null_response = response["plugins"][5]
         
     | 
| 
      
 644 
     | 
    
         
            +
                  assert_equal(expected_test_in_response, test_in_response)
         
     | 
| 
      
 645 
     | 
    
         
            +
                  assert_fuzzy_include(expected_null_response, null_response)
         
     | 
| 
      
 646 
     | 
    
         
            +
                end
         
     | 
| 
      
 647 
     | 
    
         
            +
             
     | 
| 
      
 648 
     | 
    
         
            +
                test "/api/plugins.json with 'with_ivars'. response contains specified instance variables of each plugin" do
         
     | 
| 
      
 649 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 650 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 651 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 652 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 653 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 654 
     | 
    
         
            +
            ")
         
     | 
| 
      
 655 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 656 
     | 
    
         
            +
                  expected_test_in_response = {
         
     | 
| 
      
 657 
     | 
    
         
            +
                    "output_plugin"   => false,
         
     | 
| 
      
 658 
     | 
    
         
            +
                    "plugin_category" => "input",
         
     | 
| 
      
 659 
     | 
    
         
            +
                    "plugin_id"       => "test_in",
         
     | 
| 
      
 660 
     | 
    
         
            +
                    "retry_count"     => nil,
         
     | 
| 
      
 661 
     | 
    
         
            +
                    "type"            => "test_in",
         
     | 
| 
      
 662 
     | 
    
         
            +
                    "instance_variables" => {"id" => "test_in"},
         
     | 
| 
      
 663 
     | 
    
         
            +
                    "emit_records"   => 0,
         
     | 
| 
      
 664 
     | 
    
         
            +
                    "emit_size"      => 0,
         
     | 
| 
      
 665 
     | 
    
         
            +
                  }
         
     | 
| 
      
 666 
     | 
    
         
            +
                  expected_null_response = {
         
     | 
| 
      
 667 
     | 
    
         
            +
                    "buffer_queue_length" => 0,
         
     | 
| 
      
 668 
     | 
    
         
            +
                    "buffer_timekeys" => [],
         
     | 
| 
      
 669 
     | 
    
         
            +
                    "buffer_total_queued_size" => 0,
         
     | 
| 
      
 670 
     | 
    
         
            +
                    "output_plugin"   => true,
         
     | 
| 
      
 671 
     | 
    
         
            +
                    "plugin_category" => "output",
         
     | 
| 
      
 672 
     | 
    
         
            +
                    "plugin_id"       => "null",
         
     | 
| 
      
 673 
     | 
    
         
            +
                    "retry_count"     => 0,
         
     | 
| 
      
 674 
     | 
    
         
            +
                    "type"            => "null",
         
     | 
| 
      
 675 
     | 
    
         
            +
                    "instance_variables" => {"id" => "null"},
         
     | 
| 
      
 676 
     | 
    
         
            +
                    "buffer_available_buffer_space_ratios" => Float,
         
     | 
| 
      
 677 
     | 
    
         
            +
                    "buffer_queue_byte_size" => Integer,
         
     | 
| 
      
 678 
     | 
    
         
            +
                    "buffer_stage_byte_size" => Integer,
         
     | 
| 
      
 679 
     | 
    
         
            +
                    "buffer_stage_length" => Integer,
         
     | 
| 
      
 680 
     | 
    
         
            +
                    "emit_count"      => Integer,
         
     | 
| 
      
 681 
     | 
    
         
            +
                    "emit_records"    => Integer,
         
     | 
| 
      
 682 
     | 
    
         
            +
                    "emit_size"       => Integer,
         
     | 
| 
      
 683 
     | 
    
         
            +
                    "write_count"     => Integer,
         
     | 
| 
      
 684 
     | 
    
         
            +
                    "rollback_count"  => Integer,
         
     | 
| 
      
 685 
     | 
    
         
            +
                    "slow_flush_count" => Integer,
         
     | 
| 
      
 686 
     | 
    
         
            +
                    "flush_time_count" => Integer,
         
     | 
| 
      
 687 
     | 
    
         
            +
                  }
         
     | 
| 
      
 688 
     | 
    
         
            +
                  response = JSON.parse(get("http://127.0.0.1:#{@port}/api/plugins.json?with_config=no&with_retry=no&with_ivars=id,num_errors").body)
         
     | 
| 
      
 689 
     | 
    
         
            +
                  test_in_response = response["plugins"][0]
         
     | 
| 
      
 690 
     | 
    
         
            +
                  null_response = response["plugins"][5]
         
     | 
| 
      
 691 
     | 
    
         
            +
                  assert_equal(expected_test_in_response, test_in_response)
         
     | 
| 
      
 692 
     | 
    
         
            +
                  assert_fuzzy_equal(expected_null_response, null_response)
         
     | 
| 
      
 693 
     | 
    
         
            +
                end
         
     | 
| 
      
 694 
     | 
    
         
            +
             
     | 
| 
      
 695 
     | 
    
         
            +
                test "/api/config" do
         
     | 
| 
      
 696 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 697 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 698 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 699 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 700 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 701 
     | 
    
         
            +
            ")
         
     | 
| 
      
 702 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 703 
     | 
    
         
            +
                  expected_response_regex = %r{pid:\d+\tppid:\d+\tversion:#{Fluent::VERSION}\tconfig_path:#{@filepath}\tpid_file:\tplugin_dirs:/etc/fluent/plugin\tlog_path:}
         
     | 
| 
      
 704 
     | 
    
         
            +
                  assert_match(expected_response_regex,
         
     | 
| 
      
 705 
     | 
    
         
            +
                               get("http://127.0.0.1:#{@port}/api/config").body)
         
     | 
| 
      
 706 
     | 
    
         
            +
                end
         
     | 
| 
      
 707 
     | 
    
         
            +
             
     | 
| 
      
 708 
     | 
    
         
            +
                test "/api/config.json" do
         
     | 
| 
      
 709 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 710 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 711 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 712 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 713 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 714 
     | 
    
         
            +
            ")
         
     | 
| 
      
 715 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 716 
     | 
    
         
            +
                  res = JSON.parse(get("http://127.0.0.1:#{@port}/api/config.json").body)
         
     | 
| 
      
 717 
     | 
    
         
            +
                  assert_equal(@filepath, res["config_path"])
         
     | 
| 
      
 718 
     | 
    
         
            +
                  assert_nil(res["pid_file"])
         
     | 
| 
      
 719 
     | 
    
         
            +
                  assert_equal(["/etc/fluent/plugin"], res["plugin_dirs"])
         
     | 
| 
      
 720 
     | 
    
         
            +
                  assert_nil(res["log_path"])
         
     | 
| 
      
 721 
     | 
    
         
            +
                  assert_equal(Fluent::VERSION, res["version"])
         
     | 
| 
      
 722 
     | 
    
         
            +
                end
         
     | 
| 
      
 723 
     | 
    
         
            +
             
     | 
| 
      
 724 
     | 
    
         
            +
                test "/api/config.json?debug=1" do
         
     | 
| 
      
 725 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 726 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 727 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 728 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 729 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 730 
     | 
    
         
            +
            ")
         
     | 
| 
      
 731 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 732 
     | 
    
         
            +
                  # To check pretty print
         
     | 
| 
      
 733 
     | 
    
         
            +
                  assert_true !get("http://127.0.0.1:#{@port}/api/config.json").body.include?("\n")
         
     | 
| 
      
 734 
     | 
    
         
            +
                  assert_true get("http://127.0.0.1:#{@port}/api/config.json?debug=1").body.include?("\n")
         
     | 
| 
      
 735 
     | 
    
         
            +
                end
         
     | 
| 
      
 736 
     | 
    
         
            +
             
     | 
| 
      
 737 
     | 
    
         
            +
                test "/api/config.json/not_found" do
         
     | 
| 
      
 738 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 739 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 740 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 741 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 742 
     | 
    
         
            +
              tag monitor
         
     | 
| 
      
 743 
     | 
    
         
            +
            ")
         
     | 
| 
      
 744 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 745 
     | 
    
         
            +
                  resp = get("http://127.0.0.1:#{@port}/api/config.json/not_found")
         
     | 
| 
      
 746 
     | 
    
         
            +
                  assert_equal('404', resp.code)
         
     | 
| 
      
 747 
     | 
    
         
            +
                  body = JSON.parse(resp.body)
         
     | 
| 
      
 748 
     | 
    
         
            +
                  assert_equal(body['message'], 'Not found')
         
     | 
| 
      
 749 
     | 
    
         
            +
                end
         
     | 
| 
      
 750 
     | 
    
         
            +
              end
         
     | 
| 
      
 751 
     | 
    
         
            +
             
     | 
| 
      
 752 
     | 
    
         
            +
              sub_test_case "check retry of buffered plugins" do
         
     | 
| 
      
 753 
     | 
    
         
            +
                class FluentTestFailWriteOutput < ::Fluent::Plugin::Output
         
     | 
| 
      
 754 
     | 
    
         
            +
                  ::Fluent::Plugin.register_output('test_out_fail_write', self)
         
     | 
| 
      
 755 
     | 
    
         
            +
             
     | 
| 
      
 756 
     | 
    
         
            +
                  def write(chunk)
         
     | 
| 
      
 757 
     | 
    
         
            +
                    raise "chunk error!"
         
     | 
| 
      
 758 
     | 
    
         
            +
                  end
         
     | 
| 
      
 759 
     | 
    
         
            +
                end
         
     | 
| 
      
 760 
     | 
    
         
            +
             
     | 
| 
      
 761 
     | 
    
         
            +
                setup do
         
     | 
| 
      
 762 
     | 
    
         
            +
                  @port = unused_port
         
     | 
| 
      
 763 
     | 
    
         
            +
                  # check @type and type in one configuration
         
     | 
| 
      
 764 
     | 
    
         
            +
                  conf = <<-EOC
         
     | 
| 
      
 765 
     | 
    
         
            +
            <source>
         
     | 
| 
      
 766 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 767 
     | 
    
         
            +
              @id monitor_agent
         
     | 
| 
      
 768 
     | 
    
         
            +
              bind "127.0.0.1"
         
     | 
| 
      
 769 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 770 
     | 
    
         
            +
            </source>
         
     | 
| 
      
 771 
     | 
    
         
            +
            <match **>
         
     | 
| 
      
 772 
     | 
    
         
            +
              @type test_out_fail_write
         
     | 
| 
      
 773 
     | 
    
         
            +
              @id test_out_fail_write
         
     | 
| 
      
 774 
     | 
    
         
            +
              <buffer time>
         
     | 
| 
      
 775 
     | 
    
         
            +
                timekey 1m
         
     | 
| 
      
 776 
     | 
    
         
            +
                flush_mode immediate
         
     | 
| 
      
 777 
     | 
    
         
            +
              </buffer>
         
     | 
| 
      
 778 
     | 
    
         
            +
            </match>
         
     | 
| 
      
 779 
     | 
    
         
            +
                  EOC
         
     | 
| 
      
 780 
     | 
    
         
            +
                  @ra = Fluent::RootAgent.new(log: $log)
         
     | 
| 
      
 781 
     | 
    
         
            +
                  stub(Fluent::Engine).root_agent { @ra }
         
     | 
| 
      
 782 
     | 
    
         
            +
                  @ra = configure_ra(@ra, conf)
         
     | 
| 
      
 783 
     | 
    
         
            +
                end
         
     | 
| 
      
 784 
     | 
    
         
            +
             
     | 
| 
      
 785 
     | 
    
         
            +
                test "/api/plugins.json retry object should be filled if flush was failed" do
         
     | 
| 
      
 786 
     | 
    
         
            +
             
     | 
| 
      
 787 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 788 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 789 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 790 
     | 
    
         
            +
              port #{@port}
         
     | 
| 
      
 791 
     | 
    
         
            +
              include_config no
         
     | 
| 
      
 792 
     | 
    
         
            +
            ")
         
     | 
| 
      
 793 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 794 
     | 
    
         
            +
                  output = @ra.outputs[0]
         
     | 
| 
      
 795 
     | 
    
         
            +
                  output.start
         
     | 
| 
      
 796 
     | 
    
         
            +
                  output.after_start
         
     | 
| 
      
 797 
     | 
    
         
            +
                  expected_test_out_fail_write_response = {
         
     | 
| 
      
 798 
     | 
    
         
            +
                      "buffer_queue_length" => 1,
         
     | 
| 
      
 799 
     | 
    
         
            +
                      "buffer_timekeys" => [output.calculate_timekey(event_time)],
         
     | 
| 
      
 800 
     | 
    
         
            +
                      "buffer_total_queued_size" => 40,
         
     | 
| 
      
 801 
     | 
    
         
            +
                      "output_plugin" => true,
         
     | 
| 
      
 802 
     | 
    
         
            +
                      "plugin_category" => "output",
         
     | 
| 
      
 803 
     | 
    
         
            +
                      "plugin_id" => "test_out_fail_write",
         
     | 
| 
      
 804 
     | 
    
         
            +
                      "type" => "test_out_fail_write",
         
     | 
| 
      
 805 
     | 
    
         
            +
                      "buffer_newest_timekey" => output.calculate_timekey(event_time),
         
     | 
| 
      
 806 
     | 
    
         
            +
                      "buffer_oldest_timekey" => output.calculate_timekey(event_time),
         
     | 
| 
      
 807 
     | 
    
         
            +
                      "buffer_available_buffer_space_ratios" => Float,
         
     | 
| 
      
 808 
     | 
    
         
            +
                      "buffer_queue_byte_size" => Integer,
         
     | 
| 
      
 809 
     | 
    
         
            +
                      "buffer_stage_byte_size" => Integer,
         
     | 
| 
      
 810 
     | 
    
         
            +
                      "buffer_stage_length" => Integer,
         
     | 
| 
      
 811 
     | 
    
         
            +
                      "emit_count" => Integer,
         
     | 
| 
      
 812 
     | 
    
         
            +
                      "emit_records" => Integer,
         
     | 
| 
      
 813 
     | 
    
         
            +
                      "emit_size" => Integer,
         
     | 
| 
      
 814 
     | 
    
         
            +
                      "write_count" => Integer,
         
     | 
| 
      
 815 
     | 
    
         
            +
                      "rollback_count" => Integer,
         
     | 
| 
      
 816 
     | 
    
         
            +
                      'slow_flush_count' => Integer,
         
     | 
| 
      
 817 
     | 
    
         
            +
                      'flush_time_count' => Integer,
         
     | 
| 
      
 818 
     | 
    
         
            +
                  }
         
     | 
| 
      
 819 
     | 
    
         
            +
                  output.emit_events('test.tag', Fluent::ArrayEventStream.new([[event_time, {"message" => "test failed flush 1"}]]))
         
     | 
| 
      
 820 
     | 
    
         
            +
                  # flush few times to check steps
         
     | 
| 
      
 821 
     | 
    
         
            +
                  2.times do
         
     | 
| 
      
 822 
     | 
    
         
            +
                    output.force_flush
         
     | 
| 
      
 823 
     | 
    
         
            +
                    # output.force_flush calls #submit_flush_all, but #submit_flush_all skips to call #submit_flush_once when @retry exists.
         
     | 
| 
      
 824 
     | 
    
         
            +
                    # So that forced flush in retry state should be done by calling #submit_flush_once directly.
         
     | 
| 
      
 825 
     | 
    
         
            +
                    output.submit_flush_once
         
     | 
| 
      
 826 
     | 
    
         
            +
                    sleep 0.1 until output.buffer.queued?
         
     | 
| 
      
 827 
     | 
    
         
            +
                  end
         
     | 
| 
      
 828 
     | 
    
         
            +
                  response = JSON.parse(get("http://127.0.0.1:#{@port}/api/plugins.json").body)
         
     | 
| 
      
 829 
     | 
    
         
            +
                  test_out_fail_write_response = response["plugins"][1]
         
     | 
| 
      
 830 
     | 
    
         
            +
                  # remove dynamic keys
         
     | 
| 
      
 831 
     | 
    
         
            +
                  response_retry_count = test_out_fail_write_response.delete("retry_count")
         
     | 
| 
      
 832 
     | 
    
         
            +
                  response_retry = test_out_fail_write_response.delete("retry")
         
     | 
| 
      
 833 
     | 
    
         
            +
                  assert_fuzzy_equal(expected_test_out_fail_write_response, test_out_fail_write_response)
         
     | 
| 
      
 834 
     | 
    
         
            +
                  assert{ response_retry.has_key?("steps") }
         
     | 
| 
      
 835 
     | 
    
         
            +
                  # it's very hard to check exact retry count (because retries are called by output flush thread scheduling)
         
     | 
| 
      
 836 
     | 
    
         
            +
                  assert{ response_retry_count >= 1 && response_retry["steps"] >= 0 }
         
     | 
| 
      
 837 
     | 
    
         
            +
                  assert{ response_retry_count == response_retry["steps"] + 1 }
         
     | 
| 
      
 838 
     | 
    
         
            +
                end
         
     | 
| 
      
 839 
     | 
    
         
            +
              end
         
     | 
| 
      
 840 
     | 
    
         
            +
             
     | 
| 
      
 841 
     | 
    
         
            +
              sub_test_case "check the port number of http server" do
         
     | 
| 
      
 842 
     | 
    
         
            +
                test "on single worker environment" do
         
     | 
| 
      
 843 
     | 
    
         
            +
                  port = unused_port
         
     | 
| 
      
 844 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 845 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 846 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 847 
     | 
    
         
            +
              port #{port}
         
     | 
| 
      
 848 
     | 
    
         
            +
            ")
         
     | 
| 
      
 849 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 850 
     | 
    
         
            +
                  assert_equal("200", get("http://127.0.0.1:#{port}/api/plugins").code)
         
     | 
| 
      
 851 
     | 
    
         
            +
                end
         
     | 
| 
      
 852 
     | 
    
         
            +
             
     | 
| 
      
 853 
     | 
    
         
            +
                test "worker_id = 2 on multi worker environment" do
         
     | 
| 
      
 854 
     | 
    
         
            +
                  port = unused_port
         
     | 
| 
      
 855 
     | 
    
         
            +
                  Fluent::SystemConfig.overwrite_system_config('workers' => 4) do
         
     | 
| 
      
 856 
     | 
    
         
            +
                    d = Fluent::Test::Driver::Input.new(Fluent::Plugin::MonitorAgentInput)
         
     | 
| 
      
 857 
     | 
    
         
            +
                    d.instance.instance_eval{ @_fluentd_worker_id = 2 }
         
     | 
| 
      
 858 
     | 
    
         
            +
                    d.configure("
         
     | 
| 
      
 859 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 860 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 861 
     | 
    
         
            +
              port #{port - 2}
         
     | 
| 
      
 862 
     | 
    
         
            +
            ")
         
     | 
| 
      
 863 
     | 
    
         
            +
                    d.instance.start
         
     | 
| 
      
 864 
     | 
    
         
            +
                  end
         
     | 
| 
      
 865 
     | 
    
         
            +
                  assert_equal("200", get("http://127.0.0.1:#{port}/api/plugins").code)
         
     | 
| 
      
 866 
     | 
    
         
            +
                end
         
     | 
| 
      
 867 
     | 
    
         
            +
              end
         
     | 
| 
      
 868 
     | 
    
         
            +
             
     | 
| 
      
 869 
     | 
    
         
            +
              sub_test_case "check NoMethodError does not happen" do
         
     | 
| 
      
 870 
     | 
    
         
            +
                class FluentTestBufferVariableOutput < ::Fluent::Plugin::Output
         
     | 
| 
      
 871 
     | 
    
         
            +
                  ::Fluent::Plugin.register_output('test_out_buffer_variable', self)
         
     | 
| 
      
 872 
     | 
    
         
            +
                  def configure(conf)
         
     | 
| 
      
 873 
     | 
    
         
            +
                    super
         
     | 
| 
      
 874 
     | 
    
         
            +
                    @buffer = []
         
     | 
| 
      
 875 
     | 
    
         
            +
                  end
         
     | 
| 
      
 876 
     | 
    
         
            +
             
     | 
| 
      
 877 
     | 
    
         
            +
                  def write(chunk)
         
     | 
| 
      
 878 
     | 
    
         
            +
                  end
         
     | 
| 
      
 879 
     | 
    
         
            +
                end
         
     | 
| 
      
 880 
     | 
    
         
            +
                class FluentTestBufferVariableFilter < ::Fluent::Plugin::Filter
         
     | 
| 
      
 881 
     | 
    
         
            +
                  ::Fluent::Plugin.register_filter("test_filter_buffer_variable", self)
         
     | 
| 
      
 882 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 883 
     | 
    
         
            +
                    super
         
     | 
| 
      
 884 
     | 
    
         
            +
                    @buffer = {}
         
     | 
| 
      
 885 
     | 
    
         
            +
                  end
         
     | 
| 
      
 886 
     | 
    
         
            +
                  def filter(tag, time, record)
         
     | 
| 
      
 887 
     | 
    
         
            +
                    record
         
     | 
| 
      
 888 
     | 
    
         
            +
                  end
         
     | 
| 
      
 889 
     | 
    
         
            +
                end
         
     | 
| 
      
 890 
     | 
    
         
            +
             
     | 
| 
      
 891 
     | 
    
         
            +
                setup do
         
     | 
| 
      
 892 
     | 
    
         
            +
                  conf = <<-EOC
         
     | 
| 
      
 893 
     | 
    
         
            +
            <match **>
         
     | 
| 
      
 894 
     | 
    
         
            +
              @type test_out_buffer_variable
         
     | 
| 
      
 895 
     | 
    
         
            +
              @id test_out_buffer_variable
         
     | 
| 
      
 896 
     | 
    
         
            +
            </match>
         
     | 
| 
      
 897 
     | 
    
         
            +
            <filter **>
         
     | 
| 
      
 898 
     | 
    
         
            +
              @type test_filter_buffer_variable
         
     | 
| 
      
 899 
     | 
    
         
            +
              @id test_filter_buffer_variable
         
     | 
| 
      
 900 
     | 
    
         
            +
            </filter>
         
     | 
| 
      
 901 
     | 
    
         
            +
            EOC
         
     | 
| 
      
 902 
     | 
    
         
            +
                  @ra = Fluent::RootAgent.new(log: $log)
         
     | 
| 
      
 903 
     | 
    
         
            +
                  stub(Fluent::Engine).root_agent { @ra }
         
     | 
| 
      
 904 
     | 
    
         
            +
                  @ra = configure_ra(@ra, conf)
         
     | 
| 
      
 905 
     | 
    
         
            +
                end
         
     | 
| 
      
 906 
     | 
    
         
            +
             
     | 
| 
      
 907 
     | 
    
         
            +
                test "plugins have a variable named buffer does not throws NoMethodError" do
         
     | 
| 
      
 908 
     | 
    
         
            +
                  port = unused_port
         
     | 
| 
      
 909 
     | 
    
         
            +
                  d = create_driver("
         
     | 
| 
      
 910 
     | 
    
         
            +
              @type monitor_agent
         
     | 
| 
      
 911 
     | 
    
         
            +
              bind '127.0.0.1'
         
     | 
| 
      
 912 
     | 
    
         
            +
              port #{port}
         
     | 
| 
      
 913 
     | 
    
         
            +
              include_config no
         
     | 
| 
      
 914 
     | 
    
         
            +
            ")
         
     | 
| 
      
 915 
     | 
    
         
            +
                  d.instance.start
         
     | 
| 
      
 916 
     | 
    
         
            +
             
     | 
| 
      
 917 
     | 
    
         
            +
                  assert_equal("200", get("http://127.0.0.1:#{port}/api/plugins.json").code)
         
     | 
| 
      
 918 
     | 
    
         
            +
                  assert{ d.logs.none?{|log| log.include?("NoMethodError") } }
         
     | 
| 
      
 919 
     | 
    
         
            +
                  assert_equal(false, d.instance.instance_variable_get(:@first_warn))
         
     | 
| 
      
 920 
     | 
    
         
            +
                end
         
     | 
| 
      
 921 
     | 
    
         
            +
              end
         
     | 
| 
      
 922 
     | 
    
         
            +
            end
         
     |