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

An failing test to demonstrate #732 #734

Merged
merged 2 commits into from
Apr 22, 2017

Conversation

pierredavidbelanger
Copy link
Contributor

No description provided.

@pierredavidbelanger
Copy link
Contributor Author

My last commit should fix the problem.

I do not really know what I am doing here (I am not really good with Guice), I just had a feeling that the Provider returned Jedis instance should not be a singleton/reused, we should let the Provider create an instance each time, and the application will .close() them.

I may be wrong, in which case I really do not know why the test case is working now :)

@pierredavidbelanger
Copy link
Contributor Author

In fac, the provider will not create an instance each time, it will pool.getResource() when asked for Jedis.class, this instance will not be reused (since not a singleton anymore), so when one call .close() on it (or using it in a try-with-resources) it will be correctly returned to the pool.

I am pretty sure this is why it works now.

The travis build is still failing though, I did not check why, but I guess I was wrong to assume you had a redis instance up during the test :)

@pierredavidbelanger
Copy link
Contributor Author

The build is failing because in 3 tests, RedisTest is expecting AnnotatedBindingBuilder.asEagerSingleton() to be called.

I will fix the tests.

@jknack jknack added the fixed label Apr 21, 2017
@jknack jknack self-requested a review April 21, 2017 13:40
@jknack jknack added this to the 1.1.1 milestone Apr 21, 2017
@jknack
Copy link
Member

jknack commented Apr 21, 2017

Same here :)

Thank you.

@jknack
Copy link
Member

jknack commented Apr 21, 2017

You're welcome to join the team :)

@pierredavidbelanger
Copy link
Contributor Author

I am sorry, I do not know how to properly fix this test (without being an integration test).

I just commented some lines so not actual connection will be made, but this will render the test useless.

If you have some idea to properly fix this test, tel me and I will try to push again to this branch, otherwise, I will leave the code like this and it will be up to you to delete the class or make it work properly.

The build is failing because to redis instance can be reached on localhost:6379:

Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at redis.clients.jedis.Connection.connect(Connection.java:158)
	... 34 common frames omitted

Copy link
Member

@jknack jknack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you did is OK and should work. I'm going to review and fix it.

I'm not going to merge this pull because it is a simply change but you made 5 commits ;). In general, like to keep git history clean and easy to follow, this is the reason of why I'm not going to merge your changes (but will copy and paste).

In general if you need to fix something in an opened pull request use: git commit --amend

Thanks.

@jknack jknack closed this Apr 22, 2017
@pierredavidbelanger
Copy link
Contributor Author

What some project owners are doing, is leave PR commits as is, because it is easier to follow the thread when commits are in the right sequence relative to the comments.

When the owner feels it is time to merge, they ask the contributor to rebase.

This way: no copy/paste mess, clean history and the burden of the clean up is on the contributor not the project owner ;)

@jknack
Copy link
Member

jknack commented Apr 22, 2017

can you rebase? let's do it (asked before for rebase but never got an answer)

please rebase and will happily merge it!

@jknack jknack reopened this Apr 22, 2017
@pierredavidbelanger
Copy link
Contributor Author

Haha, yeah, some people are afraid to rebase.
I must argue it is not the simplest thing to do with GIT.

Rebase is in progress.
Thank you.

@pierredavidbelanger
Copy link
Contributor Author

Here you go, rebased (amend and squash) into two commits.

The test is still commented though, as I do not know how to test this without any actual redis connection.

@jknack
Copy link
Member

jknack commented Apr 22, 2017

We don't have integration tests for jedis, so don't worry. I will merge, test and if everything is good, the unit test is enough.

Thank you.

@jknack jknack merged commit 9cdc7a3 into jooby-project:master Apr 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants