Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Dec 15, 2022
    • Cal Herries's avatar
      Update datetime-diff tests for more drivers (#27239) · 3be48090
      Cal Herries authored
      * Don't run some tests for drivers not supporting timestamptz
      
      * Format rows in tests
      
      * Add new dataset specifically for testing the time type. Some drivers don't support time with time zone, so we can't use attempted-murders.
      
      * Replace diff-type-test-cases with test-data-with-time
      Unverified
      3be48090
  2. Dec 14, 2022
    • Noah Moss's avatar
      BE endpoint to clear group memberships (#26555) · 7828c1e6
      Noah Moss authored
      * BE endpoint to clear group membership
      
      * update ee group manager tests with clear-memberships
      Unverified
      7828c1e6
    • Noah Moss's avatar
      Hide auth config pages from setting managers (#27187) · 90320851
      Noah Moss authored
      * make auth settings adminOnly on FE
      
      * WIP backend changes
      
      * Update relevant settings
      
      * address lint warning
      
      * new tests, and a bunch of reorganization
      
      * remove broken EE settings test, and fix validation in google & ldap endpoints
      
      * fix cypress tests
      
      * add clarifying table to setting docs
      Unverified
      90320851
    • dpsutton's avatar
      Relieve db pressure on api/health check (#27192) · 0975f5d9
      dpsutton authored
      * Relieve db pressure on api/health check
      
      https://github.com/metabase/metabase/issues/26266
      
      Servers under heavy load can be slow to respond to the api/health
      check. This can lead to k8s killing healthy instances happily humming
      along serving requests.
      
      One idea floated was to use QoSFilters
      https://www.eclipse.org/jetty/javadoc/jetty-9/org/eclipse/jetty/servlets/QoSFilter.html
      to prioritize those requests in front of others. But I suspect this
      might not be our bottleneck.
      
      Our health endpoint was updated to see if it could acquire an endpoint
      when we were dealing with connection pool issues. We were reporting the
      instance was healthy once it has finished the init process, but would
      report healthy if 60/15 app-db connections were used and no actual
      queries could complete.
      
      The remedy was adding
      `(sql-jdbc.conn/can-connect-with-spec? {:datasource (mdb.connection/data-source)})`
      to the endpoint. But now to get information about the health of the
      system we have to wait in the queue to get a datasource.
      
      The hope is that this change which monitors for recent db
      checkins (query success) and checkouts (query begun) can be a proxy for
      db activity without having to wait for a connection and hit the db ourselves.
      
      Some simple and crude benchmarking:
      - use `siege` to hit `api/database/<app-db>/sync_schema`
      - in a separate tab, use `siege` to hit `api/health`
      
      Three trials with unconditional db access and conditional db
      access (look for recent activity set by the new `ConnectionCustomizer`).
      
      One siege client is synching the app-db's schema with 80 clients each
      sending 60 requests. the other has 1 client sending 60 requests to api/health.
      
      Run             |  Elapsed Time | max tx  | tx rate
       before change  |    7.16s      |  0.79s  |  8.38 tx/s
       before change  |   23.91s      |  1.44s  |  2.51 tx/s
       before change  |   13.00s      |  0.50s  |  4.62 tx/s
      ----------------------------------------------------
       after change   |    4.46s      |  0.27s  |  13.45 tx/s
       after change   |    5.81s      |  0.61s  |  10.33 tx/s
       after change   |    4.54s      |  0.44s  |  13.22 tx/s
      
      Full(er) results below:
      
      ```
      Unconditional db access
      =======================
      
      siege -c80 -r 40 "http://localhost:3000/api/database/2/sync_schema POST" -H "Cookie: $SESSION"
      
      siege -c 1 -r 60 "http://localhost:3000/api/health"
      
      Elapsed time:		        7.16 secs
      Response time:		        0.12 secs
      Transaction rate:	        8.38 trans/sec
      Longest transaction:	        0.79
      Shortest transaction:	        0.01
      
      Elapsed time:		       23.91 secs
      Response time:		        0.40 secs
      Transaction rate:	        2.51 trans/sec
      Longest transaction:	        1.44
      Shortest transaction:	        0.02
      
      Elapsed time:		       13.00 secs
      Response time:		        0.22 secs
      Transaction rate:	        4.62 trans/sec
      Longest transaction:	        0.50
      Shortest transaction:	        0.06
      
      Conditional db access
      ==============================================================
      
      Elapsed time:		        4.46 secs
      Response time:		        0.07 secs
      Transaction rate:	       13.45 trans/sec
      Longest transaction:	        0.27
      Shortest transaction:	        0.01
      
      Elapsed time:		        5.81 secs
      Response time:		        0.10 secs
      Transaction rate:	       10.33 trans/sec
      Longest transaction:	        0.61
      Shortest transaction:	        0.00
      
      Elapsed time:		        4.54 secs
      Response time:		        0.08 secs
      Transaction rate:	       13.22 trans/sec
      Longest transaction:	        0.44
      Shortest transaction:	        0.01
      ```
      
      * Remove reflection in `.put` call (not the reflections trategy)
      
      also remove the call to `classloader/the-classloader` as it did nothing
      
      * Comment and settle on a single method
      
      * tests
      
      * select from db twice
      
      had a failure in CI. give it time to do its thing with another db call
      
      * block to wait for timestamp update?
      
      * unflake the tests
      
      tasks and events from outside the thread can hit the db. the
      ConnectionCustomizer is also run from c3p0 controlled threads so we
      can't easily isolate everything to our thread
      
      Was running
      
      ```clojure
      (comment
        (dotimes [n 5]
          (dotimes [_ 100]
            (recent-activity-test)
            (CheckinTracker-test))
          (println (* (inc n) 100)))
          )
      ```
      
      to run the tests 500 times and would keep getting flakes at a rate
      ~1/100 to 1/500. Just frustration for the future.
      
      * typehint
      
      * Switch it up a bit
      
      Tests were flaking in h2 and I don't know why. I'm switching to just
      updating recent activity on most methods.
      Unverified
      0975f5d9
    • Cal Herries's avatar
      Improve datetimeDiff type error message (#27225) · 8e385d49
      Cal Herries authored
      * Update test
      
      * Update implementations
      Unverified
      8e385d49
    • Ngoc Khuat's avatar
      Suppress console log when using `with-log-messages-for-level` (#26468) · ed1d503f
      Ngoc Khuat authored
      * disable additivity when using "with-log-level"
      
      * only set when parent is root
      
      * wording
      
      * remove a test that is no longer needed
      
      * fix indents
      
      * one missing indent fix
      Unverified
      ed1d503f
  3. Dec 13, 2022
  4. Dec 12, 2022
  5. Dec 09, 2022
  6. Dec 08, 2022
    • Cam Saul's avatar
      Add `=?` test expression type (#23982) · 43236c0a
      Cam Saul authored
      
      * ≈ [WIP] [ci skip]
      
      * Minor cleanup [ci skip]
      
      * Code cleanup. [ci skip]
      
      * Kondo in CI should fetch library configs
      
      * Bump Methodical version
      
      * Change name to `=?`
      
      * Add `#exactly` reader tag
      
      * Add `#schema` data reader
      
      * Fix dev deps indentation and add `algo.generic`
      
      * Add `approx=`
      
      * Improved version of `#approx`
      
      * Just check in third party Kondo config for now instead of fighting CI
      
      * Update test/metabase/test_runner/assert_exprs/approximately_equal_test.clj
      
      Co-authored-by: default avatarTim Macdonald <tim@metabase.com>
      
      * Address PR feedback and fix sequence comparison
      
      Co-authored-by: default avatarTim Macdonald <tim@metabase.com>
      Unverified
      43236c0a
    • Cam Saul's avatar
      Add import and export (SerDes v2) commands (#26984) · 3d5ddd9c
      Cam Saul authored
      * Add import and export (SerDes v2) commands
      
      * Allow use of deprecated dump/load in EE tests
      Unverified
      3d5ddd9c
    • metamben's avatar
      Store DBMS version in Database (#26983) · f4901387
      metamben authored
      * Store DBMS version in Database
      * Add DBMS version to anonymous stats
      * Add dbms_version sync tests
      * Add test for DBMS versions in anonymous stats
      Unverified
      f4901387
    • Bryan Maass's avatar
      only query for db-metadata once per sync operation + scan each table for its PKs (#26810) · d3a98472
      Bryan Maass authored
      * memoize snowflake describe-database w/ 5 min ttl
      
      * pass in db-metadata where it is used,
      
      - rather than querying for it in random functions
      
      * update callsite of sync-tables-and-database!
      
      * let sync-metabase-metadata! look up db-metadata
      
      - only when needed
      
      * pass catalog (db), and schema to .getPrimaryKeys
      
      * let describe-table* add in the nil table-name
      
      * cleanup
      
      * use :snowflake instead of driver for inheritance
      
      * concurrent-sync-test should call describe-database once
      
      * cleaning up
      
      * call add-table-pks with 3 args
      
      * call add-table-pks with 3 args
      
      * try escaping entity names to appease Oracle Driver
      
      - Oracle wants the table-name to be escaped
      - escape is usually a no-op
      
      * pass driver to escape entity
      
      * pull get-table-pks into a multimethod,
      
      - handle the discrepancy directly in Oracle driver
      
      * remove inline def
      
      * fix colliding consistent-namespace linting
      
      - metabase.driver.sql-jdbc.common and
        metabase.driver.sql-jdbc.sync.common were
        mapped to sql-jdbc.common
      - metabase.driver.sql-jdbc.sync.common is now
        mapped to sql-jdbc.sync.common
      
      * fix reflection warnings
      
      * apply fix for getting oracle pks
      
      * nix an unused arg
      Unverified
      d3a98472
    • Cam Saul's avatar
      Support standard deviation aggregations for MongoDB (#27025) · c39f17fe
      Cam Saul authored
      * MongoDB test data config should not hardcode the user and password we use in CI
      
      * Minor test data interface dox improvements
      
      * Support standard deviation and variance for MongoDB
      
      * Oops I got :expressions mixed up with :expression-aggregations
      
      * Note about calculating variance
      
      * `connection-type` instead of `db-or-server`
      Unverified
      c39f17fe
    • Ngoc Khuat's avatar
    • Cal Herries's avatar
      datetime-diff function for SQL Server (#27002) · dc746c4e
      Cal Herries authored
      * Remove hard-coded drivers from datetime-diff-type-test
      
      * Add requirement for set-timezone for datetime-time-zones-test
      
      * Add sqlserver implementation
      
      * Change datetime-diff-time-zones-test to test drivers that don't support set-timezone
      
      * Refactor
      
      * Temporarily remove snowflake from datetime-diff-type-test
      Unverified
      dc746c4e
    • Cal Herries's avatar
      Fix incorrect parens (#27033) · 1875fede
      Cal Herries authored
      Unverified
      1875fede
  7. Dec 07, 2022
    • dpsutton's avatar
      Fix numeric parameter values in jwt (#26969) · f342fe17
      dpsutton authored
      * Fix numeric parameter values in jwt
      
      Don't call `seq` on numbers. If its a string, assert it isn't blank,
      otherwise check that it is non-null.
      
      * bind (:value request-param)
      Unverified
      f342fe17
    • dpsutton's avatar
      Fix flaky `remap-human-readable-string-column-test` (#27050) · b43eaf7e
      dpsutton authored
      * Fix flaky `remap-human-readable-string-column-test`
      
      Quite annoying test that would flake quite a bit in CI.
      
      the problem is that the mechanism for `mt/with-column-remappings` wasn't
      aware of the case when there were pre-existing mappings. It just blindly
      added a new mapping. But when the middleware fetching the remappings, it
      found the preexisting ones.
      
      For the venue.name field in this test, that was ("20th Century
      Cafe","25°","33 Taps","800 Degrees Neapolitan Pizzeria", ...). We were
      passing in fake names like "apple", "banana", "kiwi" and it found no
      remappings for those in the db.
      
      So the fix is to check for pre-existing ones, and if found, use
      `tu/with-temp-vals-in-db` to temporarily set them to the desired values,
      otherwise use some new ones with `tt/with-temp*` as it was doing
      previously.
      
      * log errors for CI
      
      * Only use type :full field values when remapping
      
      we store cached chained filter values in here (with type :linked-filter,
      there are also type :sandbox in there) but the :full are the ones that
      are used for remapping.
      
      In the tests, if the chain link tests have already run, there can be 6
      field values for the field here (`(mt/id :venues :name)`) and we want to
      make sure we update the full one, not the chain filter ones
      
      ```clojure
      [{:hash_key "576275248",
        :has_more_values false,
        :last_used_at #t "2022-12-07T21:08:35.592931Z",
        :type :linked-filter,
        :updated_at #t "2022-12-07T21:10:22.972907Z",
        :human_readable_values
        ("Appletini" "Bananasplit" "Kiwi-flavored Thing"), ;; the test updatedthe existing :linked-filter one
        :id 560,
        :values ("apple" "banana" "kiwi"),
        :field_id 15,
        :created_at #t "2022-12-07T21:08:35.592931Z"}
       {:hash_key "-897793959",
        :has_more_values false,
        :last_used_at #t "2022-12-07T21:08:35.695344Z",
        :type :linked-filter,
        :updated_at #t "2022-12-07T21:08:35.695344Z",
        :human_readable_values [],
        :id 564,
        :values ("Kinaree Thai Bistro" "Krua Siri"),
        :field_id 15,
        :created_at #t "2022-12-07T21:08:35.695344Z"}
       {:hash_key "388078290",
        :has_more_values false,
        :last_used_at #t "2022-12-07T21:08:35.742561Z",
        :type :linked-filter,
        :updated_at #t "2022-12-07T21:08:35.742561Z",
        :human_readable_values [],
        :id 566,
        :values ("Tacos Villa Corona" "Tito's Tacos"),
        :field_id 15,
        :created_at #t "2022-12-07T21:08:35.742561Z"}
       {:hash_key "-299897589",
        :has_more_values false,
        :last_used_at #t "2022-12-07T21:08:35.777517Z",
        :type :linked-filter,
        :updated_at #t "2022-12-07T21:08:35.777517Z",
        :human_readable_values [],
        :id 567,
        :values ("Festa" "Fred 62"),
        :field_id 15,
        :created_at #t "2022-12-07T21:08:35.777517Z"}
       {:hash_key "-391654650",
        :has_more_values false,
        :last_used_at #t "2022-12-07T21:08:36.681046Z",
        :type :linked-filter,
        :updated_at #t "2022-12-07T21:08:36.681046Z",
        :human_readable_values [],
        :id 569,
        :values ("Baby Blues BBQ" "Beachwood BBQ & Brewing" "Bludso's BBQ"),
        :field_id 15,
        :created_at #t "2022-12-07T21:08:36.681046Z"}
       {:hash_key "1784886858",
        :has_more_values false,
        :last_used_at #t "2022-12-07T21:08:36.860010Z",
        :type :linked-filter,
        :updated_at #t "2022-12-07T21:08:36.860010Z",
        :human_readable_values [],
        :id 572,
        :values ("Baby Blues BBQ" "Beachwood BBQ & Brewing" "Bludso's BBQ"),
        :field_id 15,
        :created_at #t "2022-12-07T21:08:36.860010Z"}
       {:hash_key nil,
        :has_more_values false,
        :last_used_at #t "2022-12-07T21:04:04.299251Z",
        :type :full, ;; but should have updated this one
        :updated_at #t "2022-12-07T21:04:04.299251Z",
        :human_readable_values [],
        :id 4,
        :values
        ("20th Century Cafe"
         "25°"
         "33 Taps"
         "800 Degrees Neapolitan Pizzeria"
         "BCD Tofu House"),
        :field_id 15,
        :created_at #t "2022-12-07T20:57:21.896298Z"}]
      ```
      
      * remove CI logging
      Unverified
      b43eaf7e
    • Cal Herries's avatar
      datetime-diff function for snowflake (#26746) · c328eb1b
      Cal Herries authored
      * Add snowflake datetime-diff implementation
      
      * Get timestamps without timezones or offsets working
      
      * Convert to timestamp_tz, not timestamp
      
      * Format rows in tests
      
      * Fix snowflake set-parameter
      
      * Add failing tests
      
      * Fix bigquery
      
      * Formatting
      
      * Replace literals for datetime-diff-time-zones-test
      
      * Revert "Fix snowflake set-parameter"
      
      This reverts commit c24348a436f3f0f2639a12d6ea368399d1549739.
      
      * Actually use fields
      
      * Fix typo
      
      * Rename dataset
      
      * Add type/DateTimeWithTZ column, since redshift doesn't like type/DateTimeWithZoneOffset
      
      * Fix snowflake for time zones
      
      * Undo changes to extract and date-trunc
      
      * Explicitly set UTC timezone
      
      * Fix mismatched types
      
      * Remove redundant bindings
      
      * Remove redundant comment
      
      * Add failing tests
      
      * Remove duplicate dataset
      Unverified
      c328eb1b
  8. Dec 06, 2022
  9. Dec 05, 2022
  10. Dec 02, 2022
Loading