Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20220310141349_remove_dependency_list_usage_data_from_redis_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c00685c139777642bcc28ba5a59113543788e80f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'spec_helper'
require_migration!

RSpec.describe RemoveDependencyListUsageDataFromRedis, :migration, :clean_gitlab_redis_shared_state do
  let(:key) { "DEPENDENCY_LIST_USAGE_COUNTER" }

  describe "#up" do
    it 'removes the hash from redis' do
      with_redis do |redis|
        redis.hincrby(key, 1, 1)
        redis.hincrby(key, 2, 1)
      end

      expect { migrate! }.to change { with_redis { |r| r.hgetall(key) } }.from({ '1' => '1', '2' => '1' }).to({})
    end
  end

  def with_redis(&block)
    Gitlab::Redis::SharedState.with(&block)
  end
end