diff options
Diffstat (limited to 'spec/lib/peek/views/click_house_spec.rb')
-rw-r--r-- | spec/lib/peek/views/click_house_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/lib/peek/views/click_house_spec.rb b/spec/lib/peek/views/click_house_spec.rb index 9d7d06204fc..1ff49afd728 100644 --- a/spec/lib/peek/views/click_house_spec.rb +++ b/spec/lib/peek/views/click_house_spec.rb @@ -16,9 +16,15 @@ RSpec.describe Peek::Views::ClickHouse, :click_house, :request_store, feature_ca data = ClickHouse::Client.select('SELECT 1 AS value', :main) ClickHouse::Client.execute('INSERT INTO events (id) VALUES (1)', :main) + Tempfile.open(['test', '.csv.gz']) do |f| + File.binwrite(f.path, ActiveSupport::Gzip.compress("id\n10\n20")) + + ClickHouse::Client.insert_csv('INSERT INTO events (id) FORMAT CSV', File.open(f.path), :main) + end + expect(data).to eq([{ 'value' => 1 }]) - expect(results[:calls]).to eq(2) + expect(results[:calls]).to eq(3) expect(results[:duration]).to be_kind_of(String) expect(results[:details]).to match_array([ @@ -30,6 +36,11 @@ RSpec.describe Peek::Views::ClickHouse, :click_house, :request_store, feature_ca sql: 'INSERT INTO events (id) VALUES (1)', database: 'database: main', statistics: include('written_rows=>"1"') + }), + a_hash_including({ + sql: 'INSERT INTO events (id) FORMAT CSV', + database: 'database: main', + statistics: include('written_rows=>"2"') }) ]) end |