Skip to content

Commit

Permalink
add unit test for reload flag
Browse files Browse the repository at this point in the history
  • Loading branch information
bajajneha27 committed Aug 9, 2023
1 parent ee089e3 commit f7f1ee9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/googleauth/compute_engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,16 @@ def make_auth_stubs opts
ENV.delete "GCE_METADATA_HOST"
end
end

it "should honor reload flag" do
begin
stub = stub_request(:get, "http://169.254.169.254")
.with(headers: { "Metadata-Flavor" => "Google" })
.to_return(status: 200,
headers: { "Metadata-Flavor" => "Google" })
expect(GCECredentials.on_gce?({}, false)).to eq(true)
expect(stub).to_not have_been_requested
end
end
end
end

0 comments on commit f7f1ee9

Please sign in to comment.