The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix running app DB with MariaDB 10.6 official image in CI (#70824)
Cam Saul5217327fb931
diff --git a/.github/workflows/app-db.yml b/.github/workflows/app-db.ymlindex eddb2055cec..b7df370c83e 100644--- a/.github/workflows/app-db.yml+++ b/.github/workflows/app-db.yml@@ -22,12 +22,12 @@ jobs:version:- name: MariaDB 10.6junit-name: be-tests-mariadb-10-6-ee- image: circleci/mariadb:10.6+ image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-imageenv:enable-ssl-tests: 'false'- name: MariaDB Latestjunit-name: be-tests-mariadb-latest-ee- image: circleci/mariadb:latest+ image: mariadb:latestenv:enable-ssl-tests: 'false'job:@@ -57,8 +57,8 @@ jobs:ports:- "3306:3306"env:- MYSQL_ALLOW_EMPTY_PASSWORD: true- MYSQL_DATABASE: circle_test+ MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true+ MARIADB_DATABASE: mb_testenv:# Only run old migrations tests on pushes to master or release branches. All other branches should skip tests# with the tag `mb/old-migrations-test`. `__ADDITIONAL_EXCLUDED_TAG__` is not used anywhere outside of splicing@@ -81,7 +81,7 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: root#@@ -136,7 +136,7 @@ jobs:version:- name: MySQL 8.4junit-name: be-tests-mysql-8-4-ee- image: cimg/mysql:8.4+ image: mysql:8.4env:enable-ssl-tests: 'false'enable-aws-iam-tests: 'false'@@ -174,7 +174,7 @@ jobs:- "3306:3306"env:MYSQL_ALLOW_EMPTY_PASSWORD: true- MYSQL_DATABASE: circle_test+ MYSQL_DATABASE: mb_testenv:# Only run old migrations tests on pushes to master or release branches. All other branches should skip tests# with the tag `mb/old-migrations-test`. `__ADDITIONAL_EXCLUDED_TAG__` is not used anywhere outside of splicing@@ -197,7 +197,7 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: root#diff --git a/.github/workflows/cross-branch-migrations.yml b/.github/workflows/cross-branch-migrations.ymlindex d38fe102a16..f84f900249b 100644--- a/.github/workflows/cross-branch-migrations.yml+++ b/.github/workflows/cross-branch-migrations.yml@@ -46,16 +46,16 @@ jobs:MB_DB_TYPE: postgresMB_DB_PORT: 5432MB_DB_HOST: localhost- MB_DB_DBNAME: circle_test- MB_DB_USER: circle_test+ MB_DB_DBNAME: mb_test+ MB_DB_USER: mb_testservices:postgres:image: postgres:14-alpineports:- "5432:5432"env:- POSTGRES_USER: circle_test- POSTGRES_DB: circle_test+ POSTGRES_USER: mb_test+ POSTGRES_DB: mb_testPOSTGRES_HOST_AUTH_METHOD: truststeps:- uses: actions/checkout@v4@@ -72,16 +72,16 @@ jobs:MB_DB_TYPE: postgresMB_DB_PORT: 5432MB_DB_HOST: localhost- MB_DB_DBNAME: circle_test- MB_DB_USER: circle_test+ MB_DB_DBNAME: mb_test+ MB_DB_USER: mb_testservices:postgres:- image: circleci/postgres:latest+ image: postgres:latestports:- "5432:5432"env:- POSTGRES_USER: circle_test- POSTGRES_DB: circle_test+ POSTGRES_USER: mb_test+ POSTGRES_DB: mb_testPOSTGRES_HOST_AUTH_METHOD: truststeps:- uses: actions/checkout@v4@@ -98,13 +98,16 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootservices:mysql:- image: cimg/mysql:8.4+ image: mysql:8.4ports:- "3306:3306"+ env:+ MYSQL_ALLOW_EMPTY_PASSWORD: true+ MYSQL_DATABASE: mb_teststeps:- uses: actions/checkout@v4- uses: ./.github/actions/cross-branch-migration-test@@ -120,7 +123,7 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: rootservices:@@ -128,7 +131,7 @@ jobs:image: mysql:latestenv:MYSQL_ALLOW_EMPTY_PASSWORD: true- MYSQL_DATABASE: circle_test+ MYSQL_DATABASE: mb_testports:- "3306:3306"steps:@@ -146,13 +149,17 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootservices:mariadb:- image: circleci/mariadb:10.6+ image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-image+ image: ${{ matrix.version.image }}ports:- "3306:3306"+ env:+ MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true+ MARIADB_DATABASE: mb_teststeps:- uses: actions/checkout@v4- uses: ./.github/actions/cross-branch-migration-test@@ -168,13 +175,16 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootservices:mariadb:- image: circleci/mariadb:latest+ image: mariadb:latestports:- "3306:3306"+ env:+ MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true+ MARIADB_DATABASE: mb_teststeps:- uses: actions/checkout@v4- uses: ./.github/actions/cross-branch-migration-testdiff --git a/.github/workflows/drivers-stress-test.yml b/.github/workflows/drivers-stress-test.ymlindex 8283acda7f0..858dc3eef44 100644--- a/.github/workflows/drivers-stress-test.yml+++ b/.github/workflows/drivers-stress-test.yml@@ -119,14 +119,17 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: rootservices:mariadb:- image: circleci/mariadb:10.6+ image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-imageports:- "3306:3306"+ env:+ MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true+ MARIADB_DATABASE: mb_teststeps:- uses: actions/checkout@v4- name: Test MariaDB driver (10.6)@@ -145,14 +148,17 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: rootservices:mariadb:- image: circleci/mariadb:latest+ image: mariadb:latestports:- "3306:3306"+ env:+ MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true+ MARIADB_DATABASE: mb_teststeps:- uses: actions/checkout@v4- name: Test MariaDB driver (latest)@@ -284,7 +290,7 @@ jobs:MB_MONGO_TEST_PASSWORD: metasample123services:mongodb:- image: circleci/mongo:latest+ image: mongo:latestports:- "27017:27017"env:@@ -308,14 +314,17 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: rootservices:mysql:- image: cimg/mysql:8.4+ image: mysql:8.4ports:- "3306:3306"+ env:+ MYSQL_ALLOW_EMPTY_PASSWORD: true+ MYSQL_DATABASE: mb_teststeps:- uses: actions/checkout@v4- name: Test MySQL driver (8.4)@@ -334,7 +343,7 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: root# set up env vars for something named "MYSQL_SSL" to run MySQL SSL tests verifying connectivity with PEM cert@@ -463,20 +472,20 @@ jobs:MB_DB_TYPE: postgresMB_DB_PORT: 5432MB_DB_HOST: localhost- MB_DB_DBNAME: circle_test- MB_DB_USER: circle_test- MB_POSTGRESQL_TEST_USER: circle_test+ MB_DB_DBNAME: mb_test+ MB_DB_USER: mb_test+ MB_POSTGRESQL_TEST_USER: mb_testMB_POSTGRES_SSL_TEST_SSL: trueMB_POSTGRES_SSL_TEST_SSL_MODE: verify-fullMB_POSTGRES_SSL_TEST_SSL_ROOT_CERT_PATH: 'test-resources/certificates/us-east-2-bundle.pem'services:postgres:- image: circleci/postgres:latest+ image: postgres:latestports:- "5432:5432"env:- POSTGRES_USER: circle_test- POSTGRES_DB: circle_test+ POSTGRES_USER: mb_test+ POSTGRES_DB: mb_testPOSTGRES_HOST_AUTH_METHOD: truststeps:- uses: actions/checkout@v4diff --git a/.github/workflows/drivers.yml b/.github/workflows/drivers.ymlindex ce6a8ccf614..32528c56b51 100644--- a/.github/workflows/drivers.yml+++ b/.github/workflows/drivers.yml@@ -563,13 +563,13 @@ jobs:version:- name: MariaDB 10.6junit-name: be-tests-mariadb-10-6-ee- image: circleci/mariadb:10.6+ image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-imageenv:enable-ssl-tests: 'false'enable-aws-iam-tests: 'false'- name: MariaDB Latestjunit-name: be-tests-mariadb-latest-ee- image: circleci/mariadb:latest+ image: mariadb:latestenv:enable-ssl-tests: 'false'enable-aws-iam-tests: 'false'@@ -602,7 +602,7 @@ jobs:- "3306:3306"env:MYSQL_ALLOW_EMPTY_PASSWORD: true- MYSQL_DATABASE: circle_test+ MYSQL_DATABASE: mb_testenv:# Only run old migrations tests on pushes to master or release branches. All other branches should skip tests# with the tag `mb/old-migrations-test`. `__ADDITIONAL_EXCLUDED_TAG__` is not used anywhere outside of splicing@@ -625,7 +625,7 @@ jobs:MB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: root#diff --git a/.github/workflows/semantic-search.yml b/.github/workflows/semantic-search.ymlindex f4fdb821260..5af14b110b6 100644--- a/.github/workflows/semantic-search.yml+++ b/.github/workflows/semantic-search.yml@@ -77,11 +77,11 @@ jobs:version:- name: MariaDB 10.6 with pgvector pg17junit-name: semantic-search-tests-mariadb-10-6- mariadb-image: circleci/mariadb:10.6+ mariadb-image: metabase/mariadb:10.6 # https://github.com/metabase/metabase-mariadb-docker-imagepgvector-image: pgvector/pgvector:pg17- name: MariaDB Latest with pgvector pg17junit-name: semantic-search-tests-mariadb-latest- mariadb-image: circleci/mariadb:latest+ mariadb-image: mariadb:latestpgvector-image: pgvector/pgvector:pg17job:- name: Semantic Search Tests@@ -104,15 +104,15 @@ jobs:ports:- "3306:3306"env:- MYSQL_ALLOW_EMPTY_PASSWORD: true- MYSQL_DATABASE: circle_test+ MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true+ MARIADB_DATABASE: mb_testenv:CI: 'true'DRIVERS: mysqlMB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: rootMB_PGVECTOR_DB_URL: 'jdbc:postgres://localhost:5432/mb_semantic_search?user=postgres&password=postgres'@@ -151,7 +151,7 @@ jobs:version:- name: MySQL 8.4 with pgvector pg17junit-name: semantic-search-tests-mysql-8-4- mysql-image: cimg/mysql:8.4+ mysql-image: mysql:8.4pgvector-image: pgvector/pgvector:pg17- name: MySQL Latest with pgvector pg17junit-name: semantic-search-tests-mysql-latest@@ -179,14 +179,14 @@ jobs:- "3306:3306"env:MYSQL_ALLOW_EMPTY_PASSWORD: true- MYSQL_DATABASE: circle_test+ MYSQL_DATABASE: mb_testenv:CI: 'true'DRIVERS: mysqlMB_DB_TYPE: mysqlMB_DB_HOST: localhostMB_DB_PORT: 3306- MB_DB_DBNAME: circle_test+ MB_DB_DBNAME: mb_testMB_DB_USER: rootMB_MYSQL_TEST_USER: rootMB_PGVECTOR_DB_URL: 'jdbc:postgres://localhost:5432/mb_semantic_search?user=postgres&password=postgres'diff --git a/src/metabase/driver/mysql/actions.clj b/src/metabase/driver/mysql/actions.cljindex b6f51d40e42..2fcbd3ed895 100644--- a/src/metabase/driver/mysql/actions.clj+++ b/src/metabase/driver/mysql/actions.clj@@ -118,7 +118,7 @@(defmethod sql-jdbc.actions/maybe-parse-sql-error [:mysql driver-api/violate-permission-constraint][_driver error-type _database action-type error-message](or (when-let [[_match _command _table-name]- (re-find #"(INSERT|UPDATE|DELETE) command denied to user .* for table '(.+)'" error-message)]+ (re-find #"(INSERT|UPDATE|DELETE) command denied to user .* for table (.+)" error-message)](merge {:type error-type}(case action-type(:table.row/create :model.row/create)diff --git a/test/metabase/data_studio/api/table_test.clj b/test/metabase/data_studio/api/table_test.cljindex b075b13b65d..ff4b3096a70 100644--- a/test/metabase/data_studio/api/table_test.clj+++ b/test/metabase/data_studio/api/table_test.clj@@ -140,48 +140,49 @@(is (= "You don't have permissions to do that."(mt/user-http-request :rasta :post 403 "data-studio/table/discard-values" {:database_ids [(mt/id)]})))))-(deftest ^:parallel bulk-discard-values-test- (testing "POST /api/data-studio/table/discard-values"- (mt/with-temp- [:model/Database {d1 :id} {:engine "h2", :details (:details (mt/db))}- :model/Database {d2 :id} {:engine "h2", :details (:details (mt/db))}- :model/Table {t1 :id} {:db_id d1, :schema "PUBLIC"}- :model/Table {t2 :id} {:db_id d1, :schema "PUBLIC"}- :model/Table {t3 :id} {:db_id d2, :schema "PUBLIC"}- :model/Table {t4 :id} {:db_id d2, :schema "PUBLIC"}- :model/Table {t5 :id} {:db_id d2, :schema "FOO"}- :model/Field {f1 :id} {:table_id t1}- :model/FieldValues {v1 :id} {:field_id f1, :values ["T1"]}- :model/Field {f2 :id} {:table_id t2}- :model/FieldValues {v2 :id} {:field_id f2, :values ["T2"]}- :model/Field {f3 :id} {:table_id t3}- :model/FieldValues {v3 :id} {:field_id f3, :values ["T3"]}- :model/Field {f4 :id} {:table_id t4}- :model/FieldValues {v4 :id} {:field_id f4, :values ["T4-1"]}- :model/Field {f5 :id} {:table_id t4}- :model/FieldValues {v5 :id} {:field_id f5, :values ["T4-2"]}- :model/Field {f6 :id} {:table_id t5}- :model/FieldValues {v6 :id} {:field_id f6, :values ["T5-1"]}- :model/Field {f7 :id} {:table_id t5}- :model/FieldValues {v7 :id} {:field_id f7, :values ["T5-2"]}]- (let [url "data-studio/table/discard-values"- remaining-field-values-q {:select [:fv.id]- :from [[(t2/table-name :model/FieldValues) :fv]- [(t2/table-name :model/Field) :f]]- :where [:and [:= :fv.field_id :f.id]- [:in :f.table_id [t1 t2 t3 t4 t5]]]- :order-by [[:fv.id :asc]]}- get-field-values #(mapv :id (t2/query remaining-field-values-q))]- (testing "Non-admin toucans should not be allowed to discard values"- (is (= "You don't have permissions to do that." (mt/user-http-request :rasta :post 403 url {:table_ids [t1]})))- (testing "FieldValues should still exist"- (is (= [v1 v2 v3 v4 v5 v6 v7] (get-field-values)))))- (testing "Admins should be able to successfully delete them"- (is (nil? (mt/user-http-request :crowberto :post 204 url {:database_ids [d1],- :schema_ids [(format "%d:FOO" d2)]- :table_ids [t4]})))- (testing "Selected FieldValues should be gone"- (is (= [v3] (get-field-values)))))))))+(deftest bulk-discard-values-test+ (mt/with-empty-h2-app-db!+ (testing "POST /api/data-studio/table/discard-values"+ (mt/with-temp+ [:model/Database {d1 :id} {:engine "h2", :details (:details (mt/db))}+ :model/Database {d2 :id} {:engine "h2", :details (:details (mt/db))}+ :model/Table {t1 :id} {:db_id d1, :schema "PUBLIC"}+ :model/Table {t2 :id} {:db_id d1, :schema "PUBLIC"}+ :model/Table {t3 :id} {:db_id d2, :schema "PUBLIC"}+ :model/Table {t4 :id} {:db_id d2, :schema "PUBLIC"}+ :model/Table {t5 :id} {:db_id d2, :schema "FOO"}+ :model/Field {f1 :id} {:table_id t1}+ :model/FieldValues {v1 :id} {:field_id f1, :values ["T1"]}+ :model/Field {f2 :id} {:table_id t2}+ :model/FieldValues {v2 :id} {:field_id f2, :values ["T2"]}+ :model/Field {f3 :id} {:table_id t3}+ :model/FieldValues {v3 :id} {:field_id f3, :values ["T3"]}+ :model/Field {f4 :id} {:table_id t4}+ :model/FieldValues {v4 :id} {:field_id f4, :values ["T4-1"]}+ :model/Field {f5 :id} {:table_id t4}+ :model/FieldValues {v5 :id} {:field_id f5, :values ["T4-2"]}+ :model/Field {f6 :id} {:table_id t5}+ :model/FieldValues {v6 :id} {:field_id f6, :values ["T5-1"]}+ :model/Field {f7 :id} {:table_id t5}+ :model/FieldValues {v7 :id} {:field_id f7, :values ["T5-2"]}]+ (let [url "data-studio/table/discard-values"+ remaining-field-values-q {:select [:fv.id]+ :from [[(t2/table-name :model/FieldValues) :fv]+ [(t2/table-name :model/Field) :f]]+ :where [:and [:= :fv.field_id :f.id]+ [:in :f.table_id [t1 t2 t3 t4 t5]]]+ :order-by [[:fv.id :asc]]}+ get-field-values #(mapv :id (t2/query remaining-field-values-q))]+ (testing "Non-admin toucans should not be allowed to discard values"+ (is (= "You don't have permissions to do that." (mt/user-http-request :rasta :post 403 url {:table_ids [t1]})))+ (testing "FieldValues should still exist"+ (is (= [v1 v2 v3 v4 v5 v6 v7] (get-field-values)))))+ (testing "Admins should be able to successfully delete them"+ (is (nil? (mt/user-http-request :crowberto :post 204 url {:database_ids [d1],+ :schema_ids [(format "%d:FOO" d2)]+ :table_ids [t4]})))+ (testing "Selected FieldValues should be gone"+ (is (= [v3] (get-field-values))))))))))(deftest ^:parallel table-selectors->filter-test(testing "table-selectors->filter function generates correct WHERE clauses"diff --git a/test/metabase/query_processor/filter_test.clj b/test/metabase/query_processor/filter_test.cljindex 51c5886f777..bf60a79f3b2 100644--- a/test/metabase/query_processor/filter_test.clj+++ b/test/metabase/query_processor/filter_test.clj@@ -1040,10 +1040,10 @@(testing (str "Filtering on a specific date (DATE column) should work correctly regardless of report timezone/DB"" timezone support (#39769)")(mt/test-drivers (mt/normal-drivers)- (mt/with-temporary-setting-values [report-timezone "US/Pacific"]+ (mt/with-temporary-setting-values [report-timezone "America/Los_Angeles"](let [metadata-provider (lib.tu/merged-mock-metadata-provider(mt/metadata-provider)- {:database {:timezone "US/Pacific"}})+ {:database {:timezone "America/Los_Angeles"}})checkins (lib.metadata/table metadata-provider (mt/id :checkins))checkins-id (lib.metadata/field metadata-provider (mt/id :checkins :id))checkins-date (lib.metadata/field metadata-provider (mt/id :checkins :date))@@ -1079,10 +1079,10 @@(testing (str "Filtering on a specific date (TIMESTAMP WITH TIME ZONE column) should work correctly regardless of"" report timezone/DB timezone support (#39769)")(mt/test-drivers (mt/normal-drivers)- (mt/with-temporary-setting-values [report-timezone "US/Pacific"]+ (mt/with-temporary-setting-values [report-timezone "America/Los_Angeles"](let [metadata-provider (lib.tu/merged-mock-metadata-provider(mt/metadata-provider)- {:database {:timezone "US/Pacific"}})+ {:database {:timezone "America/Los_Angeles"}})orders (lib.metadata/table metadata-provider (mt/id :orders))orders-id (lib.metadata/field metadata-provider (mt/id :orders :id))orders-created-at (lib.metadata/field metadata-provider (mt/id :orders :created_at))diff --git a/test/metabase/query_processor/timezones_test.clj b/test/metabase/query_processor/timezones_test.cljindex 0b10e9be141..6f2eceed042 100644--- a/test/metabase/query_processor/timezones_test.clj+++ b/test/metabase/query_processor/timezones_test.clj@@ -56,7 +56,7 @@(mt/test-drivers (set-timezone-drivers)(doseq [[timezone expected-rows] {"UTC" [[12 "2014-07-03T01:30:00Z"][10 "2014-07-03T19:30:00Z"]]- "US/Pacific" [[10 "2014-07-03T12:30:00-07:00"]]}]+ "America/Los_Angeles" [[10 "2014-07-03T12:30:00-07:00"]]}](mt/with-temporary-setting-values [report-timezone timezone](is (= expected-rows(mt/formatted-rows@@ -252,7 +252,7 @@;; Oracle doesn't have a time type(mt/test-drivers (filter #(isa? driver/hierarchy % :sql) (set-timezone-drivers))(mt/dataset attempted-murders- (doseq [timezone [nil "US/Pacific" "US/Eastern" "Asia/Hong_Kong"]]+ (doseq [timezone [nil "America/Los_Angeles" "America/New_York" "Asia/Hong_Kong"]](mt/with-temporary-setting-values [report-timezone timezone](let [expected (expected-attempts)actual (select-keys (attempts) (keys expected))]@@ -366,7 +366,7 @@(mt/with-temp-test-data [["relative_filter"[{:field-name "created", :base-type :type/DateTimeWithTZ}][[expected-datetime]]]]- (doseq [timezone ["UTC" "Asia/Hong_Kong" "US/Hawaii" "America/Puerto_Rico"]]+ (doseq [timezone ["UTC" "Asia/Hong_Kong" "Pacific/Honolulu" "America/Puerto_Rico"]](mt/with-temporary-setting-values [report-timezone timezone](let [query (mt/mbql-query relative_filter {:fields [$created]:filter [:time-interval $created -1 :day]})]@@ -388,8 +388,8 @@(testing "Fixed date"(mt/dataset tz-test-data(let [expected-datetime #t "2014-07-03T01:30:00Z"]- (doseq [[timezone date-filter] [["US/Pacific" "2014-07-02"]- ["US/Eastern" "2014-07-02"]+ (doseq [[timezone date-filter] [["America/Los_Angeles" "2014-07-02"]+ ["America/New_York" "2014-07-02"]["UTC" "2014-07-03"]["Asia/Hong_Kong" "2014-07-03"]]:let [expected (-> (u.date/with-time-zone-same-instant expected-datetime timezone)diff --git a/test/metabase/warehouses_rest/api_test.clj b/test/metabase/warehouses_rest/api_test.cljindex 832f5c9584f..e4775eb4d25 100644--- a/test/metabase/warehouses_rest/api_test.clj+++ b/test/metabase/warehouses_rest/api_test.clj@@ -823,16 +823,17 @@:tables)](is (= () tables))))))-(deftest ^:parallel fetch-database-metadata-skip-fields-test- (mt/with-temp [:model/Database {db-id :id} {}- :model/Table table {:db_id db-id}- :model/Field _ {:table_id (u/the-id table)}]- (testing "GET /api/database/:id/metadata?skip_fields=true"- (let [fields (->> (mt/user-http-request :rasta :get 200 (format "database/%d/metadata?skip_fields=true" db-id))- :tables- first- :fields)]- (is (= () fields))))))+(deftest fetch-database-metadata-skip-fields-test+ (mt/with-empty-h2-app-db!+ (mt/with-temp [:model/Database {db-id :id} {}+ :model/Table table {:db_id db-id}+ :model/Field _ {:table_id (u/the-id table)}]+ (testing "GET /api/database/:id/metadata?skip_fields=true"+ (let [fields (->> (mt/user-http-request :rasta :get 200 (format "database/%d/metadata?skip_fields=true" db-id))+ :tables+ first+ :fields)]+ (is (= () fields)))))))(deftest ^:parallel autocomplete-suggestions-test(let [prefix-fn (fn [db-id prefix]@@ -1035,20 +1036,21 @@:total 0}(get-all :rasta "database?include_only_uploadable=true" old-ids)))))))))-(deftest ^:parallel databases-list-can-upload-test- (testing "GET /api/database"- (let [old-ids (t2/select-pks-set :model/Database)]- (doseq [uploads-enabled? [true false]]- (testing (format "The database with uploads enabled for the public schema has can_upload=%s" uploads-enabled?)- (mt/with-temp [:model/Database _ {:engine :postgres- :name "The Chosen One"- :uploads_enabled uploads-enabled?- :uploads_schema_name "public"}]- (let [result (get-all :crowberto "database" old-ids)]- (is (= 1- (:total result)))- (is (= uploads-enabled?- (-> result :data first :can_upload))))))))))+(deftest databases-list-can-upload-test+ (mt/with-empty-h2-app-db!+ (testing "GET /api/database"+ (let [old-ids (t2/select-pks-set :model/Database)]+ (doseq [uploads-enabled? [true false]]+ (testing (format "The database with uploads enabled for the public schema has can_upload=%s" uploads-enabled?)+ (mt/with-temp [:model/Database _ {:engine :postgres+ :name "The Chosen One"+ :uploads_enabled uploads-enabled?+ :uploads_schema_name "public"}]+ (let [result (get-all :crowberto "database" old-ids)]+ (is (= 1+ (:total result)))+ (is (= uploads-enabled?+ (-> result :data first :can_upload)))))))))))(deftest ^:parallel databases-list-include-saved-questions-test(testing "GET /api/database?saved=true"@@ -1187,22 +1189,22 @@(check-tables-included response (virtual-table-for-card ok-card))(check-tables-not-included response (virtual-table-for-card cambiguous-card)))))))-(deftest ^:parallel databases-list-include-saved-questions-tables-test-5+(deftest databases-list-include-saved-questions-tables-test-5(testing "GET /api/database?saved=true&include=tables"(testing "should remove Cards that belong to a driver that doesn't support nested queries"- (mt/with-temp [:model/Database bad-db {:engine ::no-nested-query-support, :details {}}- :model/Card bad-card {:name "Bad Card"- :dataset_query {:database (u/the-id bad-db)- :type :native- :native {:query "[QUERY GOES HERE]"}}- :result_metadata [{:name "sparrows"- :display_name "Sparrows"- :base_type :type/Integer}]- :database_id (u/the-id bad-db)}- :model/Card ok-card (assoc (card-with-native-query "OK Card")- :result_metadata [{:name "finches"- :display_name "Finches"- :base_type :type/Integer}])]+ (mt/with-temp [:model/Database bad-db {:engine ::no-nested-query-support, :details {}}+ :model/Card bad-card {:name "Bad Card"+ :dataset_query {:database (u/the-id bad-db)+ :type :native+ :native {:query "[QUERY GOES HERE]"}}+ :result_metadata [{:name "sparrows"+ :display_name "Sparrows"+ :base_type :type/Integer}]+ :database_id (u/the-id bad-db)}+ :model/Card ok-card (assoc (card-with-native-query "OK Card")+ :result_metadata [{:name "finches"+ :display_name "Finches"+ :base_type :type/Integer}])](let [response (fetch-virtual-database)](is (malli= SavedQuestionsDBresponse))