-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(PUP-12046) Send facts for catalog download
#9424
(PUP-12046) Send facts for catalog download
#9424
Conversation
3209b3d
to
d4d9216
Compare
d4d9216
to
0a68b60
Compare
catalog download
WIPcatalog download
spec/unit/face/catalog_spec.rb
Outdated
stub_request(:post, 'https://puppet.server.test:8140/puppet/v3/catalog/puppet.node.test?environment=*root*') | ||
.with( | ||
headers: { 'Content-Type' => 'application/x-www-form-urlencoded' }, | ||
body: /catalog_face_request_test_value/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up using a regex here because I couldn't figure out how to use hash_including
when the facts
value is a url double-encoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the double encoded facts are added as the value of the facts
query parameter, so you can do:
.with(body: hash_including("facts" => /#{test_fact[:encoded]}/)) |
That said I think what you have is fine.
headers: { 'Content-Type' => 'application/x-www-form-urlencoded' }, | ||
body: /catalog_face_request_test_value/ | ||
).to_return(:status => 200, :body => catalog.render(:json), :headers => {'Content-Type' => 'application/json'}) | ||
subject.download |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, stub_request
doesn't verify the request was made, only that if a request is made that it matches at least one stub, which could be in this file or in spec_helper. Might be good to do something like https://github.com/bblimke/webmock?tab=readme-ov-file#setting-expectations-in-rspec-on-the-stub
Facts were not always sent with the catalog request when using the catalog face. This change allows the face to send facts for the request so that the catalog returned is compiled with the correct set of facts.
0a68b60
to
c47de03
Compare
Successfully created backport PR for |
No description provided.