Skip to content

Business intelligence made simple

Improved InfluxDB test [skip ci]

Andrew Kane3faf361a7fe5
diff --git a/test/adapters/influxdb_test.rb b/test/adapters/influxdb_test.rb
index 8ac9ccb9..3675a2e0 100644
--- a/test/adapters/influxdb_test.rb
+++ b/test/adapters/influxdb_test.rb
@@ -1,9 +1,18 @@
require_relative "../test_helper"
+# USE blazer_test
+# DROP SERIES FROM items
+# INSERT items,hello=world value=1
+
class InfluxdbTest < ActionDispatch::IntegrationTest
include AdapterTest
def data_source
"influxdb"
end
+
+ def test_run
+ expected = [{"time" => "1970-01-01 00:00:00 UTC", "count_value" => "1"}]
+ assert_result expected, "SELECT COUNT(*) FROM items WHERE hello = 'world'"
+ end
end
diff --git a/test/support/adapter_test.rb b/test/support/adapter_test.rb
index a40c7c49..03667bea 100644
--- a/test/support/adapter_test.rb
+++ b/test/support/adapter_test.rb
@@ -13,8 +13,11 @@ module AdapterTest
end
def assert_result(expected, statement)
+ assert_equal expected, run_statement(statement)
+ end
+
+ def run_statement(statement)
run_query statement, data_source: data_source, format: "csv"
- assert_response :success
- assert_equal expected, CSV.parse(response.body, headers: true).map(&:to_h)
+ CSV.parse(response.body, headers: true).map(&:to_h)
end
end