Skip to content

Commit

Permalink
Fix for the URI.escape monkey patch.
Browse files Browse the repository at this point in the history
The monkey patch was not being loaded from lib/cloud/azure.rb on normal
execution, so it had to be added to lib/bosh_azure_cpi.rb . This however
loads the monkey patch even when running the unit tests so a new condition
was required on these tests.

[#181531703] [azure cpi] Fix the Docker image that builds the azure CPI
  • Loading branch information
danielfor committed Mar 23, 2022
1 parent 0ae911c commit 984a42d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bosh_azure_cpi/lib/cloud/azure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ module AzureCloud; end
require 'cloud/azure/telemetry/telemetry_event_handler'
require 'cloud/azure/telemetry/wire_client'

require 'monkey_patches/uri_monkey_patch'
Bosh::AzureCloud::URIMonkeyPatch.apply_patch

module Bosh
module Clouds
Azure = Bosh::AzureCloud::Cloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
describe Bosh::AzureCloud::URIMonkeyPatch do
describe '.apply_patch' do
context 'when URI does not have an escape method' do
before { URI.instance_eval { undef :escape } }

it 'should add the escape function' do
expect { URI.method(:escape) }.to raise_error(NameError)
expect { Bosh::AzureCloud::URIMonkeyPatch.apply_patch }.not_to raise_error
Expand Down

0 comments on commit 984a42d

Please sign in to comment.