Skip to content

Business intelligence made simple

Test MySQL cohorts [skip ci]

Andrew Kaned852e8bf910b
diff --git a/Gemfile b/Gemfile
index 57b8adee..d9be9cec 100644
--- a/Gemfile
+++ b/Gemfile
@@ -11,6 +11,7 @@ gem "sprockets-rails"
# data sources
gem "elasticsearch"
+gem "mysql2"
# anomaly detection and forecasting
gem "prophet-rb" if ENV["TEST_PROPHET"]
diff --git a/test/charts_test.rb b/test/charts_test.rb
index ed253f7e..afab6f83 100644
--- a/test/charts_test.rb
+++ b/test/charts_test.rb
@@ -46,9 +46,4 @@ class ChartsTest < ActionDispatch::IntegrationTest
run_query "SELECT NOW(), 1, 2 AS target"
assert_match %{"name":"target"}, response.body
end
-
- def test_cohort_analysis
- run_query "SELECT 1 AS user_id, NOW() AS conversion_time /* cohort analysis */", query_id: 1
- assert_match "1 cohort", response.body
- end
end
diff --git a/test/cohort_analysis_test.rb b/test/cohort_analysis_test.rb
new file mode 100644
index 00000000..523b04d7
--- /dev/null
+++ b/test/cohort_analysis_test.rb
@@ -0,0 +1,15 @@
+require_relative "test_helper"
+
+class CohortAnalysisTest < ActionDispatch::IntegrationTest
+ def test_postgres
+ run_query "SELECT 1 AS user_id, NOW() AS conversion_time /* cohort analysis */", query_id: 1
+ assert_match "1 cohort", response.body
+ end
+
+ def test_mysql
+ skip unless ENV["TEST_MYSQL"]
+
+ run_query "SELECT 1 AS user_id, NOW() AS conversion_time /* cohort analysis */", query_id: 1, data_source: "mysql"
+ assert_match "1 cohort", response.body
+ end
+end
diff --git a/test/internal/config/blazer.yml b/test/internal/config/blazer.yml
index bdd476b4..475a600d 100644
--- a/test/internal/config/blazer.yml
+++ b/test/internal/config/blazer.yml
@@ -36,6 +36,9 @@ data_sources:
adapter: elasticsearch
url: http://localhost:9200
+ mysql:
+ url: mysql2://localhost:3306/blazer_test
+
# create audits
audit: true