-
Notifications
You must be signed in to change notification settings - Fork 680
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
HTTP request resource #336
Comments
This might be best handled via a new operation in train. |
Hi @coderanger Thanks for bringing up this topic. We are thinking about this for a while, especially a way to capture the abstraction right. Current resources are expected to run on the specific machine that inspec targets. A I would love to understand your usecase better. Could you share the way you use |
One of my simpler examples where I only use the response body: https://github.com/poise/poise-service/blob/master/test/integration/default/serverspec/mixin_spec.rb#L30 More complex examples including checking response status and a multi-stage get/post/get test: https://github.com/poise/application_examples/blob/master/test/integration/dpaste/serverspec/dpaste_spec.rb The first seems pretty easy to model with train (via a new method on the transport), the latter might be a little more tricky since it needs to support POST as well. |
Overall the idea is being able to make a request against localhost no matter which mode inspec is running in. If remote, it should serialize the response and send to back over the transport with the body, status, and response headers. |
Spent some more time thinking about this last night. The cleanest solution is probably to run the locally with Net::HTTP for local, open an SSH tunnel for ssh (and then run locally as before), and to use powershell and then serialize the response for winrm. Not sure what would be best for the docker transport. |
@coderanger Interesting use case. In your case you checked From an implementation point of view: In case we would allow to check http resources, we could start with offering a new resource for normal urls aka To implement |
+1 for Currently we have to use "serverspec" + "infrataster", which is not so convenient to install. |
@legal90 For now I propose to write your own |
This should be reopened as the new resource doesn't seem answer the same use case, specifically it looks like it runs the HTTP connection locally within InSpec and so cannot test local host connections. |
@coderanger Thank you for bringing this up. |
I close this in favor for the more detailed ticket #1436 |
As
kitchen-inspec
runs remotely (unlikebusser-serverspec
) any tests using an HTTP client (e.g.Net::HTTP
) to test HTTP responses on localhost will no longer work. This should be reworked into some kind ofhttp_request
resource that works in both local and remote execution.The text was updated successfully, but these errors were encountered: