diff --git a/test/metabase/models/metric_test.clj b/test/metabase/models/metric_test.clj
index e040ae06ec444b0a1bdae31cd060196833be7204..0856bfc1eb0938ecb4a66d8feb2b63446f27687d 100644
--- a/test/metabase/models/metric_test.clj
+++ b/test/metabase/models/metric_test.clj
@@ -40,7 +40,7 @@
    :is_active               true
    :definition              {:clause ["a" "b"]}}
   (tu/with-temp* [Database [{database-id :id}]
-                  Table    [{:keys [id]} {:db_id database-id}]]
+                  Table    [{:keys [id]}      {:db_id database-id}]]
     (create-metric-then-select! id "I only want *these* things" nil (user->id :rasta) {:clause ["a" "b"]})))
 
 
@@ -49,12 +49,12 @@
   [true
    false]
   (tu/with-temp* [Database [{database-id :id}]
-                  Table    [{table-id :id}  {:db_id database-id}]
-                  Metric   [{metric-id :id} {:table_id   table-id
-                                             :definition {:database 45
-                                                          :query    {:filter ["yay"]}}}]]
+                  Table    [{table-id :id}    {:db_id database-id}]
+                  Metric   [{metric-id :id}   {:table_id   table-id
+                                               :definition {:database 45
+                                                            :query    {:filter ["yay"]}}}]]
     [(metric/exists? metric-id)
-     (metric/exists? 34)]))
+     (metric/exists? Integer/MAX_VALUE)])) ; a Metric that definitely doesn't exist
 
 
 ;; retrieve-metric
@@ -71,10 +71,10 @@
    :definition              {:database 45
                              :query    {:filter ["yay"]}}}
   (tu/with-temp* [Database [{database-id :id}]
-                  Table    [{table-id :id}  {:db_id database-id}]
-                  Metric   [{metric-id :id} {:table_id    table-id
-                                             :definition  {:database 45
-                                                           :query    {:filter ["yay"]}}}]]
+                  Table    [{table-id :id}    {:db_id database-id}]
+                  Metric   [{metric-id :id}   {:table_id    table-id
+                                               :definition  {:database 45
+                                                             :query    {:filter ["yay"]}}}]]
     (let [{:keys [creator] :as metric} (retrieve-metric metric-id)]
       (update (dissoc metric :id :table_id :created_at :updated_at)
               :creator (u/rpartial dissoc :date_joined :last_login)))))
diff --git a/test/metabase/query_processor_test/expression_aggregations_test.clj b/test/metabase/query_processor_test/expression_aggregations_test.clj
index 7c99137f028dd0a1a732624ab868f039fa86d7d6..2de64107ed2cd97cf8c12b3cb7ec16cc59bcad33 100644
--- a/test/metabase/query_processor_test/expression_aggregations_test.clj
+++ b/test/metabase/query_processor_test/expression_aggregations_test.clj
@@ -1,12 +1,13 @@
 (ns metabase.query-processor-test.expression-aggregations-test
   "Tests for expression aggregations and for named aggregations."
   (:require [expectations :refer :all]
+            [metabase.driver :as driver]
             [metabase.models.metric :refer [Metric]]
             [metabase.query-processor :as qp]
             [metabase.query-processor.expand :as ql]
             [metabase.query-processor-test :refer :all]
             [metabase.test.data :as data]
-            [metabase.test.data.datasets :as datasets, :refer [*engine*]]
+            [metabase.test.data.datasets :as datasets, :refer [*engine* *driver*]]
             [metabase.test.util :as tu]
             [metabase.util :as u]))
 
@@ -167,7 +168,7 @@
              [3  52]
              [4  30]]
    :columns [(data/format-name "price")
-             (if (= *engine* :redshift) "new price" "New Price")]} ; Redshift annoyingly always lowercases column aliases
+             (driver/format-custom-field-name *driver* "New Price")]} ; Redshift annoyingly always lowercases column aliases
   (format-rows-by [int int]
     (rows+column-names (data/run-query venues
                          (ql/aggregation (ql/named (ql/sum (ql/+ $price 1)) "New Price"))
@@ -180,7 +181,7 @@
              [3  -2]
              [4 -17]]
    :columns [(data/format-name "price")
-             (if (= *engine* :redshift) "sum-41" "Sum-41")]}
+             (driver/format-custom-field-name *driver* "Sum-41")]}
   (format-rows-by [int int]
     (rows+column-names (data/run-query venues
                          (ql/aggregation (ql/named (ql/- (ql/sum $price) 41) "Sum-41"))
@@ -208,7 +209,7 @@
              [3  39]
              [4  24]]
    :columns [(data/format-name "price")
-             (if (= *engine* :redshift) "my cool metric" "My Cool Metric")]}
+             (driver/format-custom-field-name *driver* "My Cool Metric")]}
   (tu/with-temp Metric [metric {:table_id   (data/id :venues)
                                 :definition {:aggregation [:sum [:field-id (data/id :venues :price)]]
                                              :filter      [:> [:field-id (data/id :venues :price)] 1]}}]
@@ -226,7 +227,7 @@
              [3  39]
              [4  24]]
    :columns [(data/format-name "price")
-             (if (= *engine* :redshift) "my cool metric" "My Cool Metric")]}
+             (driver/format-custom-field-name *driver* "My Cool Metric")]}
   (tu/with-temp Metric [metric {:table_id   (data/id :venues)
                                 :definition {:aggregation [[:sum [:field-id (data/id :venues :price)]]]
                                              :filter      [:> [:field-id (data/id :venues :price)] 1]}}]
@@ -240,7 +241,7 @@
 
 ;; check that named aggregations come back with the correct column metadata (#4002)
 (datasets/expect-with-engines (engines-that-support :expression-aggregations)
-  (let [col-name (if (= *engine* :redshift) "count of things" "Count of Things")]
+  (let [col-name (driver/format-custom-field-name *driver* "Count of Things")]
     (assoc (aggregate-col :count)
       :name         col-name
       :display_name col-name))