summaryrefslogtreecommitdiff
path: root/spec/migrations/20221223123019_delete_queued_jobs_for_vulnerabilities_feedback_migration_spec.rb
blob: c5e1a255653984f6ad890c20966925921e99a15c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

require 'spec_helper'
require_migration!

RSpec.describe DeleteQueuedJobsForVulnerabilitiesFeedbackMigration, feature_category: :vulnerability_management do
  let!(:migration) { described_class.new }
  let(:batched_background_migrations) { table(:batched_background_migrations) }

  before do
    batched_background_migrations.create!(
      max_value: 10,
      batch_size: 250,
      sub_batch_size: 50,
      interval: 300,
      job_class_name: 'MigrateVulnerabilitiesFeedbackToVulnerabilitiesStateTransition',
      table_name: 'vulnerability_feedback',
      column_name: 'id',
      job_arguments: [],
      gitlab_schema: "gitlab_main"
    )
  end

  describe "#up" do
    it "deletes all batched migration records" do
      expect(batched_background_migrations.count).to eq(1)

      migration.up

      expect(batched_background_migrations.count).to eq(0)
    end
  end
end