-
Notifications
You must be signed in to change notification settings - Fork 144
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
Using hound for concurrent tests #71
Comments
@josevalim sorry. I didn't have IRCcloud on. I'm totally open to changes in Hound. |
@josevalim @HashNuke I am thinking one of the simplest way, that would definitely work with all browsers and drivers, would be to add this metadata directly to the user agent string.
2 and 3 are not really needed, but I think it is better for the end user to let the library take care of those details. In the integration tests, we could then do something like
The only drawback of this approach I can think of is that it could cause problems if someone is What do you think? |
The question is if drivers can let us customize the user agent. |
AFAIK, all drivers and browsers let us customize this, which is why I think it could be a good solution. |
If we can do this, it would be excellent. @tuvistavie can you investigate and send a PR to hound that allows us to configure the user agent when we start a session? |
@josevalim Sure, I am going to give it a try! |
@tuvistavie Adding meta data to UserAgent is a brilliant solution ~! 👍 |
@HashNuke Do you know if there is a simple way to do this with Firefox? It is trivial for Chrome and PhantomJS, but for Firefox it seems we need to implement the profile, which seems to be quite a lot work for such a simple task. |
Here was my solution for creating a firefox profile. It was a bit of a chore, but once it is in place it works very well and you can customize with whatever preferences you need. I've even got it set up to use a locally-running proxy, but you may not need that. To launch the session, create the profile with a Base64-encoded profile directory (zipped) and pass to desiredCapabilities:
The BrowserInstance module which builds the Base64:
|
Awesome, if we can make this work for concurrent testing, things will be even easier from the Ecto/Phoenix integration side! |
@darksheik Thank you very much for sharing, this is really helpful! |
A bit swamped at the moment - This works well in my own Ubuntu/Mac infrastructure but I have been meaning to investigate whether I can do this without using the file system. |
@darksheik Thank you for posting details ~! |
After merging #94, we will have the possibility to add the user agent for all browsers:
However, if we use it to add metadata, I think that having a common interface I was thinking that being able to pass a
What do you think? |
That's great. It would be nice, however, if it was a single option indeed, so we can do:
In particular, I would keep the options for |
@tuvistavie once this is all said and done on the hound side, could you also please investigate integration from the Phoenix.Ecto side too? Thank you! |
/cc @tokafish |
This does seem cleaner, thank you for the feedback!
Sure, as soon as I have the time! |
@tuvistavie I vote for the driver options being under a key too. That way Hound options are easily identifiable. |
I think we are done here 🎉 |
Hi @HashNuke! I tried to ping you on IRC but it did not work out, let me know if you would like this discussion to be moved elsewhere.
Today hound already supports multiple sessions, which would allow us to run tests concurrently. With Ecto 2.0, we are introducing an ownership feature, that would also allow Ecto to run concurrently. The next step is to make both of them work together so we have concurrent integration tests.
Therefore, this issue is more of a question, than an actual feature. If changes need to be done in Hound, they will be minimal.
In order for Ecto tests to run concurrently, we need to tell each process which database connection they should use. For example, in your test:
This means that, in order for this to work with integration tests, we would need to include the connection owner in the request, parse it at the beginning of the request and call
allow
. This means that Hound would need to support a way to send a header for every request or at least a way to uniquely identify sessions.So that's the question: when we start a hound_session, would it be possible to configure hound to always add a header or an identifier in whatever request is made by that particular session? If we cannot identify particular sessions, can we at least identify requests?
Note this feature would also need to be supported through redirections. I.e. if the server redirects and the driver automatically redirects, we need to still be able to tag those.
I will be glad to send a PR but I need some guidance on what is and what isn't allowed on the driver side.
The text was updated successfully, but these errors were encountered: