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
ci: add H2 OSS driver tests to catch OSS-only failures (#68649)
bryan595e171f34d6
diff --git a/.github/actions/test-driver/action.yml b/.github/actions/test-driver/action.ymlindex cbbef70bb4d..2359cbb77a3 100644--- a/.github/actions/test-driver/action.yml+++ b/.github/actions/test-driver/action.yml@@ -12,6 +12,10 @@ inputs:logs-artifact-suffix:required: falsedescription: Suffix to append to the test logs artifact name to avoid conflicts in matrix jobs+ edition:+ required: false+ default: 'ee'+ description: Edition to test (oss or ee)runs:using: "composite"@@ -28,7 +32,7 @@ runs:env:MB_EDITION: ee- name: Test database driver- run: clojure -X:dev:ci:ee:ee-dev:drivers:drivers-dev:test ${{ inputs.test-args }}+ run: clojure -X:dev:ci:${{ inputs.edition }}:${{ inputs.edition }}-dev:drivers:drivers-dev:test ${{ inputs.test-args }}shell: bashid: run-test# Trunk Quarantine controls the final state of the run in the CI!diff --git a/.github/workflows/drivers.yml b/.github/workflows/drivers.ymlindex b568793ce1f..21e4d9222cd 100644--- a/.github/workflows/drivers.yml+++ b/.github/workflows/drivers.yml@@ -510,6 +510,37 @@ jobs:aws-region: ${{ vars.AWS_REGION }}trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}+ be-tests-h2-oss:+ needs: determine-driver-skips+ if: ${{ needs.determine-driver-skips.outputs.h2-should-run == 'true' }}+ runs-on: ubuntu-latest+ timeout-minutes: 60+ env:+ CI: 'true'+ name: H2 (OSS)+ steps:+ - uses: actions/checkout@v4+ - name: Test H2 driver (OSS)+ id: test-driver+ uses: ./.github/actions/test-driver+ with:+ junit-name: 'be-tests-h2-oss'+ edition: 'oss'+ test-args: >-+ :only-tags [:mb/driver-tests]+ :exclude-tags [:mb/transforms-python-test]+ - name: Upload Test Results+ uses: ./.github/actions/upload-test-results+ if: always()+ with:+ input-path: ./target/junit/+ output-name: ${{ github.job }}+ bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}+ aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}+ aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}+ aws-region: ${{ vars.AWS_REGION }}+ trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}+be-tests-mysql-mariadb:needs: determine-driver-skipsif: ${{ needs.determine-driver-skips.outputs.mysql-mariadb-should-run == 'true' }}diff --git a/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj b/enterprise/backend/test/metabase_enterprise/dependencies/api_test.cljindex dd681102808..e891644dfce 100644--- a/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj+++ b/enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj@@ -2543,3 +2543,40 @@(is (=? {:data [{:id card1-id}, {:id card4-id}]:total 2}response))))))))++;;; ------------------------------------------------ Table API Tests -------------------------------------------------+;;; Tests for dependency-related filtering on the /api/table endpoint++(deftest unused-only-filter-test+ (mt/with-premium-features #{:dependencies}+ (testing "GET /api/table?unused-only=true"+ (testing "filters tables that have no non-transform dependents"+ (mt/with-temp [:model/Database {db-id :id} {}+ :model/Table {table-1-id :id} {:db_id db-id, :name "table_1", :active true}+ :model/Table {table-2-id :id} {:db_id db-id, :name "table_2", :active true}]+ (testing "both tables returned without filter"+ (is (= #{table-1-id table-2-id}+ (->> (mt/user-http-request :crowberto :get 200 "table")+ (filter #(= (:db_id %) db-id))+ (map :id)+ set))))++ (testing "both tables returned with unused_only=false"+ (is (= #{table-1-id table-2-id}+ (->> (mt/user-http-request :crowberto :get 200 "table" :unused-only false)+ (filter #(= (:db_id %) db-id))+ (map :id)+ set))))++ (mt/with-temp [:model/Card card {:database_id db-id+ :table_id table-1-id+ :dataset_query {:database db-id+ :type :query+ :query {:source-table table-1-id}}}]+ (events/publish-event! :event/card-create {:object card :user-id (:creator_id card)})+ (testing "after creating card that depends on table-1, only table-2 is unused"+ (is (= #{table-2-id}+ (->> (mt/user-http-request :crowberto :get 200 "table" :unused-only true)+ (filter #(= (:db_id %) db-id))+ (map :id)+ set))))))))))diff --git a/test/metabase/warehouse_schema_rest/api/table_test.clj b/test/metabase/warehouse_schema_rest/api/table_test.cljindex fe85cdbf3ee..3aeaea976f0 100644--- a/test/metabase/warehouse_schema_rest/api/table_test.clj+++ b/test/metabase/warehouse_schema_rest/api/table_test.clj@@ -1315,39 +1315,8 @@{:visibility_type "hidden":data_layer "copper"})))))))-(deftest unused-only-filter-test- (mt/with-premium-features #{:dependencies}- (testing "GET /api/table?unused-only=true"- (testing "filters tables that have no non-transform dependents"- (mt/with-temp [:model/Database {db-id :id} {}- :model/Table {table-1-id :id} {:db_id db-id, :name "table_1", :active true}- :model/Table {table-2-id :id} {:db_id db-id, :name "table_2", :active true}]- (testing "both tables returned without filter"- (is (= #{table-1-id table-2-id}- (->> (mt/user-http-request :crowberto :get 200 "table")- (filter #(= (:db_id %) db-id))- (map :id)- set))))-- (testing "both tables returned with unused_only=false"- (is (= #{table-1-id table-2-id}- (->> (mt/user-http-request :crowberto :get 200 "table" :unused-only false)- (filter #(= (:db_id %) db-id))- (map :id)- set))))-- (mt/with-temp [:model/Card card {:database_id db-id- :table_id table-1-id- :dataset_query {:database db-id- :type :query- :query {:source-table table-1-id}}}]- (events/publish-event! :event/card-create {:object card :user-id (:creator_id card)})- (testing "after creating card that depends on table-1, only table-2 is unuseded"- (is (= #{table-2-id}- (->> (mt/user-http-request :crowberto :get 200 "table" :unused-only true)- (filter #(= (:db_id %) db-id))- (map :id)- set))))))))))+;; NOTE: unused-only-filter-test moved to enterprise/backend/test/metabase_enterprise/dependencies/api_test.clj+;; because it depends on EE event handlers to populate the dependency table(deftest orphan-only-filter-test(testing "GET /api/table?orphan-only=true"