diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/lib/gitlab/health_checks/gitaly_check_spec.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/lib/gitlab/health_checks/gitaly_check_spec.rb')
-rw-r--r-- | spec/lib/gitlab/health_checks/gitaly_check_spec.rb | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/lib/gitlab/health_checks/gitaly_check_spec.rb b/spec/lib/gitlab/health_checks/gitaly_check_spec.rb index 7c346e3eb69..000b8eff661 100644 --- a/spec/lib/gitlab/health_checks/gitaly_check_spec.rb +++ b/spec/lib/gitlab/health_checks/gitaly_check_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' RSpec.describe Gitlab::HealthChecks::GitalyCheck do let(:result_class) { Gitlab::HealthChecks::Result } @@ -14,20 +14,36 @@ RSpec.describe Gitlab::HealthChecks::GitalyCheck do subject { described_class.readiness } before do - expect(Gitlab::GitalyClient::HealthCheckService).to receive(:new).and_return(gitaly_check) + expect(Gitlab::GitalyClient::HealthCheckService).to receive(:new).and_return(healthy_check) end context 'Gitaly server is up' do - let(:gitaly_check) { double(check: { success: true }) } + before do + expect(Gitlab::GitalyClient::ServerService).to receive(:new).and_return(ready_check) + end + + let(:healthy_check) { double(check: { success: true }) } + let(:ready_check) { double(readiness_check: { success: true }) } it { is_expected.to eq([result_class.new('gitaly_check', true, nil, shard: 'default')]) } end context 'Gitaly server is down' do - let(:gitaly_check) { double(check: { success: false, message: 'Connection refused' }) } + let(:healthy_check) { double(check: { success: false, message: 'Connection refused' }) } it { is_expected.to eq([result_class.new('gitaly_check', false, 'Connection refused', shard: 'default')]) } end + + context 'Gitaly server is not ready' do + before do + expect(Gitlab::GitalyClient::ServerService).to receive(:new).and_return(ready_check) + end + + let(:healthy_check) { double(check: { success: true }) } + let(:ready_check) { double(readiness_check: { success: false, message: 'Clock is out of sync' }) } + + it { is_expected.to match_array([result_class.new('gitaly_check', false, 'Clock is out of sync', shard: 'default')]) } + end end describe '#metrics' do |