Skip to content

Commit

Permalink
chore: Add test for empty universe domain data coming from MDS (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma committed Jan 30, 2024
1 parent d27eea5 commit e5b5014
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion spec/googleauth/compute_engine_spec.rb
Expand Up @@ -69,7 +69,30 @@ def make_auth_stubs opts
end
end

context "default universe" do
context "default universe due to 404 from MDS" do
it_behaves_like "apply/apply! are OK"

it "sets the universe" do
make_auth_stubs access_token: "1/abcde"
@client.fetch_access_token!
expect(@client.universe_domain).to eq("googleapis.com")
end

it "returns a consistent expiry using cached data" do
make_auth_stubs access_token: "1/abcde"
@client.fetch_access_token!
expiry = @client.expires_at
sleep 1
@client.fetch_access_token!
expect(@client.expires_at.to_f).to be_within(0.1).of(expiry.to_f)
end
end

context "default universe due to empty data from MDS" do
before :example do
@universe_domain = ""
end

it_behaves_like "apply/apply! are OK"

it "sets the universe" do
Expand Down

0 comments on commit e5b5014

Please sign in to comment.