spec/outputs/charrington_spec.rb in logstash-output-charrington-0.3.9 vs spec/outputs/charrington_spec.rb in logstash-output-charrington-0.3.12

- old
+ new

@@ -7,29 +7,30 @@ describe 'a new payload with one event' do let(:config) do <<-CONFIG input { generator { - message => '{"app_name": "Web App", "event": "schemaless", "meta": { "type": "XML" } }' + message => '{"app_name": "Web App", "event": "schemaless", "meta": { "type": "XML" }, "published_at": "2019-07-29T20:09:18Z" }' codec => 'json' count => 1 } } output { charrington { connection_string => '#{@url}' driver_jar_path => '#{driver_path}' + schema => '' } } CONFIG end it 'creates a table and inserts a record' do drop_table('schemaless') run_pipeline - expect(query('SELECT * FROM schemaless')).to match_array([{id: "1", app_name: "Web App", event: "schemaless", inserted_at: a_kind_of(String), :meta_type => "XML"}]) + expect(query('SELECT * FROM schemaless')).to match_array([{id: "1", app_name: "Web App", event: "schemaless", inserted_at: a_kind_of(String), :meta_type => "XML", :published_at => "2019-07-29 20:09:18"}]) expect(query('SELECT COUNT(1) FROM schemaless').first[:count]).to eq("1") end end describe 'removes a trailing plus sign' do @@ -45,10 +46,11 @@ output { charrington { connection_string => '#{@url}' driver_jar_path => '#{driver_path}' + schema => '' } } CONFIG end @@ -76,10 +78,11 @@ output { charrington { connection_string => '#{@url}' driver_jar_path => '#{driver_path}' + schema => '' } } CONFIG end @@ -107,10 +110,11 @@ output { charrington { connection_string => '#{@url}' driver_jar_path => '#{driver_path}' + schema => '' } } CONFIG end @@ -164,8 +168,35 @@ ]) expect(query("SELECT COUNT(1) FROM #{schema}.from_agent").first[:count]).to eq("2") end end -end + describe 'a new payload with one event camelCase' do + let(:config) do + <<-CONFIG + input { + generator { + message => '{"app_name": "Web App", "event": "camelCase this", "meta": { "type": "XML" } }' + codec => 'json' + count => 1 + } + } + output { + charrington { + connection_string => '#{@url}' + driver_jar_path => '#{driver_path}' + schema => '' + } + } + CONFIG + end + it 'creates a table and inserts a record' do + drop_table('camel_case_this') + run_pipeline + expect(query('SELECT * FROM camel_case_this')).to match_array([{id: "1", app_name: "Web App", event: "camelCase this", inserted_at: a_kind_of(String), :meta_type => "XML"}]) + expect(query('SELECT COUNT(1) FROM camel_case_this').first[:count]).to eq("1") + end + end + +end