Skip to content
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

Add example for networking partially enabled #23

Merged
merged 1 commit into from Jul 28, 2017

Conversation

maxcnunes
Copy link
Contributor

I have some integration tests that I would like to allow real networking for my local server. But any request from that local server should be mocked. With the current version it isn't working because the mocked request will hang up forever. Seems this is the same problem from #18. And following the suggestions from that issue I could get it working. Removing the mutex.Lock makes the hanging go away. But I'm not sure this is the right solution. Although I'm also not sure mutex.Lock is really necessary in that RoundTrip. At least the real Go implementation doesn't have any mutex.Lock that I could find https://golang.org/src/net/http/transport.go?s=11576:11638#L309

@maxcnunes
Copy link
Contributor Author

Humm. The tests are failing due race condition. So that Lock is really necessary. Well at least the example I have included should help reproducing the problem.

@h2non
Copy link
Owner

h2non commented Jul 18, 2017

Thank you! I'm going to provide a fix soon based on your changes. The existent mutex is overloaded and should not be used in the store context.

@h2non
Copy link
Owner

h2non commented Jul 26, 2017

This should be already fixed in gock@v1.0.5 / master. Test it upgrading gock:

go get -u gopkg.in/h2non/gock.v1

Please, let me know if you're having any issue.

@maxcnunes maxcnunes changed the title Add example and fixing for networking hanging due it be "half enabled" Add example for networking partially enabled Jul 26, 2017
@maxcnunes maxcnunes force-pushed the networking_half_enabled branch 2 times, most recently from b3273cf to 3bb15ba Compare July 26, 2017 13:23
@maxcnunes
Copy link
Contributor Author

@h2non The hanging still happening for the example I have added.

@h2non
Copy link
Owner

h2non commented Jul 26, 2017

Oops! Will take a look later today.

h2non added a commit that referenced this pull request Jul 27, 2017
@h2non
Copy link
Owner

h2non commented Jul 27, 2017

@maxcnunes Got some time this morning. What about now? You would need to pull latest gock version.

@maxcnunes
Copy link
Contributor Author

Thanks @h2non. It is working now 👍

@h2non
Copy link
Owner

h2non commented Jul 27, 2017

Nice. Closing this PR. Thank you for reporting the issue!

@h2non h2non closed this Jul 27, 2017
@maxcnunes
Copy link
Contributor Author

@h2non This PR wasn't only to issue the bug. I was also adding an example to any other user interested in partially enabling the networking. So, could you please merge it? :)

@h2non
Copy link
Owner

h2non commented Jul 27, 2017

Yeah, sure. Will do later.

@h2non h2non reopened this Jul 27, 2017
@h2non h2non merged commit 379ef22 into h2non:master Jul 28, 2017
@maxcnunes maxcnunes deleted the networking_half_enabled branch July 28, 2017 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants