Skip to content

Commit 94bdcab

Browse files
committed
(maint) stub Facter request to external services
We added an Azure Metadata fact in Facter 4.0.52, and GH Actions VMs are running on Azure, so there's an additional http call being made which needs to be stubbed. Stub calls to EC2 endpoints.
1 parent 88726b3 commit 94bdcab

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spec/spec_helper.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,20 @@ module PuppetSpec
160160
PUPPET_FACTER_2_GCE_URL = %r{^http://metadata/computeMetadata/v1(beta1)?}.freeze
161161
PUPPET_FACTER_3_GCE_URL = "http://metadata.google.internal/computeMetadata/v1/?recursive=true&alt=json".freeze
162162

163+
# Facter azure metadata endpoint
164+
PUPPET_FACTER_AZ_URL = "http://169.254.169.254/metadata/instance?api-version=2020-09-01"
165+
166+
# Facter EC2 endpoint
167+
PUPPET_FACTER_EC2_METADATA_URL = 'http://169.254.169.254/latest/meta-data/'
168+
PUPPET_FACTER_EC2_USERDATA_URL = 'http://169.254.169.254/latest/user-data/'
169+
163170
config.around :each do |example|
164-
# Ignore requests from Facter GCE fact in Travis
171+
# Ignore requests from Facter to external services
165172
stub_request(:get, PUPPET_FACTER_2_GCE_URL)
166173
stub_request(:get, PUPPET_FACTER_3_GCE_URL)
174+
stub_request(:get, PUPPET_FACTER_AZ_URL)
175+
stub_request(:get, PUPPET_FACTER_EC2_METADATA_URL)
176+
stub_request(:get, PUPPET_FACTER_EC2_USERDATA_URL)
167177

168178
# Enable VCR if the example is tagged with `:vcr` metadata.
169179
if example.metadata[:vcr]

0 commit comments

Comments
 (0)