• Stan Hu's avatar
    Fix order-dependent failure in bulk_insert_safe_spec.rb · c57061c4
    Stan Hu authored
    This would fail if `spec/models/concerns/bulk_insert_safe_spec.rb` and
    `spec/lib/gitlab/doctor/secrets_spec.rb` were run in order.
    
    The test failed because `bulk_insert_items` is a temporary table
    inserted by the test and dropped afterwards. However, the test also
    defines a `BulkInsertItem` class, which the GitLab Doctor secrets task
    uses to identify encrypted columns.
    
    To fix this, we change `BulkInsertItem` to inherit from
    `ActiveRecord::Base` instead of `ApplicationRecord`. We also make sure
    the first spec resets the model cache after dropping the table for
    completeness.
    
    Closes https://gitlab.com/gitlab-org/gitlab/-/issues/221784
    c57061c4
bulk_insert_safe_spec.rb 6 KB