giorgio-zamparelli / mongo-in-memory

in memory mocking engine for mongo db
25 stars 4 forks source link

Ignore handshake parameters #1

Closed danielo515 closed 8 years ago

danielo515 commented 8 years ago

Hello,

Thank you for your great software, it is helping me a lot with unit testing.

One thing that would be very handy is to ignore handshake configurations. Currently if I specify any tls configuration I get this error

2016-10-06T17:27:54.467+0200 I NETWORK  [conn1] AssertionException handling request, closing client connection: 17133 SSL handshake requested, SSL feature not available in this build

So instead of throwing the following error just ignore that configurations. That will make my life easier because that way I will not need to build specific connection configurations for testing and development.

Thanks and regards

giorgio-zamparelli commented 8 years ago

Hi @danielo515! I'm not familiar with the problem. I've just google it and found this http://stackoverflow.com/questions/27070433/ssl-handshake-requested-ssl-feature-not-available-in-this-build mongo-in-memory uses https://www.npmjs.com/package/mongodb-prebuilt which apparently is a mongodb built without ssl support. I think the problem is in the client you are using. The client is requesting a SSL connection which is not supported. You should change the client side so it doesn't use SSL to connect to the testing mongodb.

danielo515 commented 8 years ago

Hello @giorgio-zamparelli

Thanks for your prompt answer. My client is basically my unit tests. Of course I can not use any SSL option, but that requires a separate configuration file without SSL. But the more custom code I write for unit testing the less reliable they are. In an ideal scenario I will be able to use the same configuration file, then if the server understands SSL use it, and it it does not just ignore any SSL option passed.

I understand that your code is not generating the error, but it could intercept any configuration passed and remove the SSL configuration until it is implemented. This makes sense because your lib is a perfect fit for unit testing and, as I said, the most production code you can reuse the better.

Regards

giorgio-zamparelli commented 8 years ago

If you know how to implement the solution you can clone this git repository, commit the changes to your clone and then do a Pull Request.

Otherwise I will need a a minimal gist or git repository that is running your unit testing and is showing the error you mentioned in order to reproduce it and understand how to fix the problem.

danielo515 commented 8 years ago

OK, that sounds fair enough.

Regards

giorgio-zamparelli commented 8 years ago

found a solution or something else @danielo515 ?

danielo515 commented 8 years ago

To be honest, not a general usage solution. I wrote a hapi plugin that mocks the real hapi-mongodb plugin, and there I'm just deleting any SSL property before I connect.

Not clean, but I think my situation is so custom that it does not deserve anything better.

giorgio-zamparelli commented 8 years ago

Anyway glad you figured it out!