test/test_config.rb in fluent-plugin-scalyr-0.8.10 vs test/test_config.rb in fluent-plugin-scalyr-0.8.11

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + # # Scalyr Output Plugin for Fluentd # # Copyright (C) 2015 Scalyr, Inc. # @@ -13,60 +15,47 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +require "helper" +require "socket" -require 'helper' -require 'socket' - -class ConfigTest < Scalyr::ScalyrOutTest - - def test_default_params - d = create_driver - hostname = Socket.gethostname - assert_not_nil( d.instance.server_attributes, "Default server_attributes should not be nil" ) - assert_equal( hostname, d.instance.server_attributes['serverHost'], "Default serverHost is not hostname" ) - assert( d.instance.ssl_verify_peer, "Default ssl_verify_peer should be true" ) - - #check default buffer limits because they are set outside of the config_set_default - assert_equal( 100*1024, d.instance.buffer.buffer_chunk_limit, "Buffer chunk limit should be 100k" ) - assert_equal( 1024, d.instance.buffer.buffer_queue_limit, "Buffer queue limit should be 1024" ) - end - +# rubocop:disable Layout/LineLength +class ConfigTest < Scalyr::ScalyrOutTest def test_custom_serverhost_not_overwritten hostname = "customHost" d = create_driver CONFIG + "server_attributes { \"serverHost\":\"#{hostname}\" }\nuse_hostname_for_serverhost true" - assert_equal( hostname, d.instance.server_attributes['serverHost'], "Custom serverHost should not be overwritten" ) + assert_equal(hostname, d.instance.server_attributes["serverHost"], "Custom serverHost should not be overwritten") end def test_configure_use_hostname_for_serverhost - d = create_driver CONFIG + 'use_hostname_for_serverhost false' - assert_nil( d.instance.server_attributes, "Default server_attributes should be nil" ) + d = create_driver CONFIG + "use_hostname_for_serverhost false" + assert_nil(d.instance.server_attributes, "Default server_attributes should be nil") end def test_configure_ssl_verify_peer - d = create_driver CONFIG + 'ssl_verify_peer false' - assert( !d.instance.ssl_verify_peer, "Config failed to set ssl_verify_peer" ) + d = create_driver CONFIG + "ssl_verify_peer false" + assert(!d.instance.ssl_verify_peer, "Config failed to set ssl_verify_peer") end def test_scalyr_server_adding_trailing_slash - d = create_driver CONFIG + 'scalyr_server http://www.example.com' - assert_equal( "http://www.example.com/", d.instance.scalyr_server, "Missing trailing slash for scalyr_server" ) + d = create_driver CONFIG + "scalyr_server http://www.example.com" + assert_equal("http://www.example.com/", d.instance.scalyr_server, "Missing trailing slash for scalyr_server") end def test_configure_ssl_ca_bundle_path - d = create_driver CONFIG + 'ssl_ca_bundle_path /test/ca-bundle.crt' - assert_equal( "/test/ca-bundle.crt", d.instance.ssl_ca_bundle_path, "Config failed to set ssl_ca_bundle_path" ) + d = create_driver CONFIG + "ssl_ca_bundle_path /test/ca-bundle.crt" + assert_equal("/test/ca-bundle.crt", d.instance.ssl_ca_bundle_path, "Config failed to set ssl_ca_bundle_path") end def test_configure_ssl_verify_depth - d = create_driver CONFIG + 'ssl_verify_depth 10' - assert_equal( 10, d.instance.ssl_verify_depth, "Config failed to set ssl_verify_depth" ) + d = create_driver CONFIG + "ssl_verify_depth 10" + assert_equal(10, d.instance.ssl_verify_depth, "Config failed to set ssl_verify_depth") end def test_configure_server_attributes d = create_driver CONFIG + 'server_attributes { "test":"value" }' - assert_equal( "value", d.instance.server_attributes["test"], "Config failed to set server_attributes" ) + assert_equal("value", d.instance.server_attributes["test"], "Config failed to set server_attributes") end end - +# rubocop:enable Layout/LineLength