Skip to content

Commit 6051763

Browse files
arampriceystros
authored andcommitted
Differentiate blobstore clients from wrappers
Signed-off-by: Brian Upton <brian.upton@broadcom.com>
1 parent 9848ee6 commit 6051763

9 files changed

+16
-15
lines changed

src/bosh-director/lib/bosh/director.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ module Director
4242

4343
require 'bosh/director/blobstore/errors'
4444
require 'bosh/director/blobstore/client'
45-
require 'bosh/director/blobstore/retryable_blobstore_client'
46-
require 'bosh/director/blobstore/sha1_verifiable_blobstore_client'
45+
require 'bosh/director/blobstore/retryable_client_wrapper'
46+
require 'bosh/director/blobstore/sha1_verifying_client_wrapper'
4747
Bosh::Director::Blobstore.autoload(:LocalClient, 'bosh/director/blobstore/local_client')
4848
Bosh::Director::Blobstore.autoload(:DavcliBlobstoreClient, 'bosh/director/blobstore/davcli_blobstore_client')
4949
Bosh::Director::Blobstore.autoload(:S3cliBlobstoreClient, 'bosh/director/blobstore/s3cli_blobstore_client')

src/bosh-director/lib/bosh/director/blobstore/retryable_blobstore_client.rb src/bosh-director/lib/bosh/director/blobstore/retryable_client_wrapper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Bosh::Director
44
module Blobstore
5-
class RetryableBlobstoreClient < Client
5+
class RetryableClientWrapper
66
extend Forwardable
77

88
def initialize(client, retryable)

src/bosh-director/lib/bosh/director/blobstore/sha1_verifiable_blobstore_client.rb src/bosh-director/lib/bosh/director/blobstore/sha1_verifying_client_wrapper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module Bosh::Director
66
module Blobstore
7-
class Sha1VerifiableBlobstoreClient < Client
7+
class Sha1VerifyingClientWrapper
88
extend Forwardable
99

1010
def initialize(client, logger)

src/bosh-director/lib/bosh/director/blobstores.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def create_client(hash)
1616

1717
bare_client = create(provider_string, options)
1818

19-
sha1_client = Blobstore::Sha1VerifiableBlobstoreClient.new(bare_client, Bosh::Director::Config.logger)
19+
sha1_client = Blobstore::Sha1VerifyingClientWrapper.new(bare_client, Bosh::Director::Config.logger)
2020
retry_config = Bosh::Retryable.new(tries: 6, sleep: 2.0, on: [Blobstore::BlobstoreError])
21-
Blobstore::RetryableBlobstoreClient.new(sha1_client, retry_config)
21+
Blobstore::RetryableClientWrapper.new(sha1_client, retry_config)
2222
end
2323

2424
def create(provider_string, options = {})

src/bosh-director/spec/unit/blobstore/retryable_blobstore_client_spec.rb src/bosh-director/spec/unit/blobstore/retryable_client_wrapper_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
module Bosh::Director::Blobstore
4-
describe RetryableBlobstoreClient do
4+
describe RetryableClientWrapper do
55
subject { described_class.new(wrapped_client, retryable) }
66
let(:wrapped_client) { instance_double('Bosh::Director::Blobstore::Client') }
77
let(:retryable) { Bosh::Retryable.new(tries: 2, sleep: 0, on: [BlobstoreError]) }

src/bosh-director/spec/unit/blobstore/sha1_verifiable_blobstore_client_spec.rb src/bosh-director/spec/unit/blobstore/sha1_verifying_client_wrapper_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
module Bosh::Director::Blobstore
4-
describe Sha1VerifiableBlobstoreClient do
4+
describe Sha1VerifyingClientWrapper do
55
subject { described_class.new(wrapped_client, per_spec_logger) }
66
let(:wrapped_client) { instance_double('Bosh::Director::Blobstore::Client') }
77
let(:multidigest_path) { 'some/path/to/binary' }

src/bosh-director/spec/unit/blobstores_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module Bosh::Director
1919
it 'builds a local client' do
2020
expect(Blobstore::LocalClient).to receive(:new).with(blobstore_config['options'])
2121

22-
expect(Blobstores.new(config).blobstore).to be_a(Blobstore::Client)
22+
Blobstores.new(config)
2323
end
2424
end
2525

@@ -37,7 +37,7 @@ module Bosh::Director
3737
it 'returns s3cli client' do
3838
expect(Blobstore::S3cliBlobstoreClient).to receive(:new).with(blobstore_config['options'])
3939

40-
expect(Blobstores.new(config).blobstore).to be_a(Blobstore::Client)
40+
Blobstores.new(config)
4141
end
4242
end
4343

@@ -53,7 +53,7 @@ module Bosh::Director
5353
it 'returns gcscli client' do
5454
expect(Blobstore::GcscliBlobstoreClient).to receive(:new).with(blobstore_config['options'])
5555

56-
expect(Blobstores.new(config).blobstore).to be_a(Blobstore::Client)
56+
Blobstores.new(config)
5757
end
5858
end
5959

@@ -73,7 +73,7 @@ module Bosh::Director
7373
it 'returns davcli client' do
7474
expect(Blobstore::DavcliBlobstoreClient).to receive(:new).with(blobstore_config['options'])
7575

76-
expect(Blobstores.new(config).blobstore).to be_a(Blobstore::Client)
76+
Blobstores.new(config)
7777
end
7878
end
7979
end

src/bosh-director/spec/unit/deployment_plan/job_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ module DeploymentPlan
162162
FactoryBot.create(:models_template, name: 'foo', blobstore_id: 'blobstore-id-1', sha1: file_content_sha1)
163163
end
164164
let(:instance) { instance_double(Bosh::Director::App, blobstores: blobstores) }
165-
let(:blobstore) { instance_double(Bosh::Director::Blobstore::RetryableBlobstoreClient) }
165+
let(:blobstore) { instance_double(Bosh::Director::Blobstore::Client) }
166166
let(:blobstores) do
167167
instance_double(Bosh::Director::Blobstores, blobstore: blobstore)
168168
end

src/bosh-director/spec/unit/deployment_plan/stages/update_stage_functional_spec.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module Bosh::Director::DeploymentPlan::Stages
3535
let(:task) { FactoryBot.create(:models_task, id: 42, username: 'user') }
3636
let(:task_writer) { Bosh::Director::TaskDBWriter.new(:event_output, task.id) }
3737
let(:event_log) { Bosh::Director::EventLog::Log.new(task_writer) }
38-
let(:blobstore) { instance_double(Bosh::Director::Blobstore::Sha1VerifiableBlobstoreClient) }
38+
let(:blobstore) { instance_double(Bosh::Director::Blobstore::Client) }
3939

4040
before do
4141
release = FactoryBot.create(:models_release, name: 'bosh-release')
@@ -82,9 +82,10 @@ module Bosh::Director::DeploymentPlan::Stages
8282

8383
allow(Bosh::Director::App).to receive_message_chain(:instance, :blobstores, :blobstore).and_return(blobstore)
8484
allow(blobstore).to receive(:get)
85-
allow(Bosh::Director::JobRenderer).to receive(:render_job_instances_with_cache)
8685
allow(blobstore).to receive(:can_sign_urls?).and_return(false)
8786
allow(blobstore).to receive(:validate!)
87+
88+
allow(Bosh::Director::JobRenderer).to receive(:render_job_instances_with_cache)
8889
end
8990

9091
context 'the director database contains an instance with a static ip but no vm assigned (due to deploy failure)' do

0 commit comments

Comments
 (0)