From c966918bdaefb06a3533cae50b276d21e2999ccd Mon Sep 17 00:00:00 2001
From: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Date: Thu, 20 Jun 2024 22:03:17 -0400
Subject: [PATCH] Don't run sandboxing rollback test on mysql (#44515)

* Don't run sandboxing rollback test on mysql

* Update test/metabase/db/schema_migrations_test.clj
---
 test/metabase/db/schema_migrations_test.clj | 56 +++++++++++----------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/test/metabase/db/schema_migrations_test.clj b/test/metabase/db/schema_migrations_test.clj
index c6ed1939269..ab572f56071 100644
--- a/test/metabase/db/schema_migrations_test.clj
+++ b/test/metabase/db/schema_migrations_test.clj
@@ -2017,33 +2017,35 @@
                (t2/select-fn-set :object (t2/table-name :model/Permissions) :group_id group-id)))))))
 
 (deftest sandboxing-rollback-test
-  (testing "Can we rollback to 49 when sandboxing is configured"
-    (impl/test-migrations ["v50.2024-01-10T03:27:29" "v50.2024-06-20T13:21:30"] [migrate!]
-      (let [db-id         (first (t2/insert-returning-pks! (t2/table-name Database) {:name       "DB"
-                                                                                     :engine     "h2"
-                                                                                     :created_at :%now
-                                                                                     :updated_at :%now
-                                                                                     :details    "{}"}))
-            table-id      (first (t2/insert-returning-pks! (t2/table-name Table) {:db_id      db-id
-                                                                                  :schema     "SchemaName"
-                                                                                  :name       "Table"
-                                                                                  :created_at :%now
-                                                                                  :updated_at :%now
-                                                                                  :active     true}))
-            permission-id (t2/insert-returning-pk! (t2/table-name :model/Permissions) {:object "/db/fake-permission/"
-                                                                                       :group_id 1})
-            _             (t2/query-one {:insert-into :sandboxes
-                                         :values      [{:group_id             1
-                                                        :table_id             table-id
-                                                        :attribute_remappings "{\"foo\", 1}"
-                                                        :permission_id        permission-id}]})
-            expected        {:group_id             1
-                             :table_id             table-id
-                             :attribute_remappings "{\"foo\", 1}"}]
-        (migrate!)
-        (is (=? expected (t2/select-one :sandboxes :table_id table-id)))
-        (migrate! :down 49)
-        (is (=? expected (t2/select-one :sandboxes :table_id table-id)))))))
+  ;; TODO (noahmoss): uncomment when fixed on mysql
+  (mt/test-drivers [:postgres :h2 #_:mysql]
+    (testing "Can we rollback to 49 when sandboxing is configured"
+      (impl/test-migrations ["v50.2024-01-10T03:27:29" "v50.2024-06-20T13:21:30"] [migrate!]
+        (let [db-id         (first (t2/insert-returning-pks! (t2/table-name Database) {:name       "DB"
+                                                                                       :engine     "h2"
+                                                                                       :created_at :%now
+                                                                                       :updated_at :%now
+                                                                                       :details    "{}"}))
+              table-id      (first (t2/insert-returning-pks! (t2/table-name Table) {:db_id      db-id
+                                                                                    :schema     "SchemaName"
+                                                                                    :name       "Table"
+                                                                                    :created_at :%now
+                                                                                    :updated_at :%now
+                                                                                    :active     true}))
+              permission-id (t2/insert-returning-pk! (t2/table-name :model/Permissions) {:object "/db/fake-permission/"
+                                                                                         :group_id 1})
+              _             (t2/query-one {:insert-into :sandboxes
+                                           :values      [{:group_id             1
+                                                          :table_id             table-id
+                                                          :attribute_remappings "{\"foo\", 1}"
+                                                          :permission_id        permission-id}]})
+              expected        {:group_id             1
+                               :table_id             table-id
+                               :attribute_remappings "{\"foo\", 1}"}]
+          (migrate!)
+          (is (=? expected (t2/select-one :sandboxes :table_id table-id)))
+          (migrate! :down 49)
+          (is (=? expected (t2/select-one :sandboxes :table_id table-id))))))))
 
 (deftest view-count-test
   (testing "report_card.view_count and report_dashboard.view_count should be populated"
-- 
GitLab