# Chef exec rspec trying to make HTTP connection?

**URL:** https://discourse.chef.io/t/chef-exec-rspec-trying-to-make-http-connection/7093
**Category:** Chef Infra (archive)
**Created:** [October 17, 2015, 10:57pm UTC](https://discourse.chef.io/t/chef-exec-rspec-trying-to-make-http-connection/7093 "2015-10-17T22:57:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jeff\_Blaine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeff_blaine/32/19_2.png) [@Jeff\_Blaine](https://discourse.chef.io/u/Jeff_Blaine)
#### Post date: [October 17, 2015, 10:57pm UTC](https://discourse.chef.io/t/chef-exec-rspec-trying-to-make-http-connection/7093/1 "2015-10-17T22:57:57Z")

</div>

I’m very confused as to what rspec is trying to do here with the simple default spec in place indicating that things should just converge successfully. If I use strace, I see rspec trying to talk to our enterprise http\_proxy for something.

```
% chef exec rspec
F

Failures:

  1) our-certs::default When all attributes are default, on an unspecified platform converges successfully
     Failure/Error: expect { chef_run }.to_not raise_error
       expected no Exception, got #<Net::HTTPFatalError: 504 "Gateway Timeout"> with backtrace:
         # ./spec/unit/recipes/default_spec.rb:7:in `block (3 levels) in <top (required)>'
         # ./spec/unit/recipes/default_spec.rb:11:in `block (4 levels) in <top (required)>'
         # ./spec/unit/recipes/default_spec.rb:11:in `block (3 levels) in <top (required)>'
     # ./spec/unit/recipes/default_spec.rb:11:in `block (3 levels) in <top (required)>'

Finished in 0.45415 seconds (files took 7.19 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/unit/recipes/default_spec.rb:10 # our-certs::default When all attributes are default, on an unspecified platform converges successfully
```

---

<div class="post-metadata">

### Author: ![martinb3](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/martinb3/32/34_2.png) [@martinb3](https://discourse.chef.io/u/martinb3)
#### Post date: [October 17, 2015, 11:35pm UTC](https://discourse.chef.io/t/chef-exec-rspec-trying-to-make-http-connection/7093/2 "2015-10-17T23:35:01Z")

</div>

Howdy! Do you have something in your Chef recipe that makes an internet connection? That’s the most logical first place I would look. I suppose it’s also possible that ChefSpec is trying to talk to Chef Zero over HTTP using your proxy if you’re using ChefSpec::ServerRunner, though I’ve never seen that happen before (and I could be totally wrong on that second point).

---

<div class="post-metadata">

### Author: ![Jeff\_Blaine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeff_blaine/32/19_2.png) [@Jeff\_Blaine](https://discourse.chef.io/u/Jeff_Blaine)
#### Post date: [October 18, 2015, 12:43am UTC](https://discourse.chef.io/t/chef-exec-rspec-trying-to-make-http-connection/7093/3 "2015-10-18T00:43:38Z")

</div>

Thanks Martin. Turns out the latter answer was exactly the problem. Unsetting my proxy environment variables got me past that exception.

As for the first idea, even if my recipe did make http connections, like with remote\_file, I would not expect ChefSpec to be converging them and making http requests.

---

<div class="post-metadata">

### Author: ![martinb3](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/martinb3/32/34_2.png) [@martinb3](https://discourse.chef.io/u/martinb3)
#### Post date: [October 18, 2015, 12:56am UTC](https://discourse.chef.io/t/chef-exec-rspec-trying-to-make-http-connection/7093/4 "2015-10-18T00:56:00Z")

</div>

> [@Jeff\_Blaine](#):
>
> Turns out the latter answer was exactly the problem. Unsetting my proxy environment variables got me past that exception.

Ah! Excellent. I would think there's no point in ChefSpec configuring Chef-Zero to obey the proxy, since it's always running locally. But I guess it does obey proxy settings...

> [@Jeff\_Blaine](#):
>
> As for the first idea, even if my recipe did make http connections, like with remote\_file, I would not expect ChefSpec to be converging them and making http requests.

I was thinking more like some pure Ruby or if you had ChefSpec configured to step into a particular resource/provider.

In any case, glad it's solved! 🙂
