contribsys / faktory_worker_ruby

Faktory worker for Ruby
GNU Lesser General Public License v3.0
214 stars 31 forks source link

Issue with unit testing #74

Closed raceves closed 1 year ago

raceves commented 1 year ago

Hello,

Wanted to report a potential bug I just uncovered; it took me a while to understand what's going on as I'm not a ruby developer by trade (but getting there). I understand the testing for the ruby worker operates by using method redirection. We actually have some unit tests set up using this and it's been working well.

Issues popped up when we updated the faktory_worker_ruby gem to version 1.2.0 - our unit tests started erroring out saying that it couldn't connect to port 7419, which is odd because it shouldn't be hitting the network.

After diff'ing the source code for both gems, I believe the error is this: Within faktory_worker_ruby, the lib\faktory\client.rb file was changed to use the cgi gem, which then changed the main open call to now be open_socket. However, the lib\faktory\testing.rb file is still just redirecting the previous open call only. Hence, no matter what, the real open_socket call will fire and will try to contact the faktory server over the network in test mode, resulting in the error.

mperham commented 1 year ago

Can you give me the full backtrace for the error so I can see the call stack?

mperham commented 1 year ago

Good debugging, you basically nailed it so I was able to quickly see and fix the issue.

raceves commented 1 year ago

Oh awesome, I'm glad that was helpful. I was just coming back to this to give you a backtrace but looks like that isn't needed any longer. I'll keep an eye out for the next release :)