arquillian / arquillian-spacelift

Arquillian process and package manager. Makes executing an external process or fetching platform depends dependencies an easier job
4 stars 7 forks source link

Running spacelift in-remote container #9

Open lordofthejars opened 10 years ago

lordofthejars commented 10 years ago

Hello, I am using this channel to ask a question about spacelift.

Let me introduce the problem with an example: I want to run tests against a MongoDB. For this reason I need to download MongoDB, install it and execute it.

I have thought to create an Arquillian extension which does all these work. The problem is that MongoDB should be installed in the same machine where container is being executed. In case of embedded and managed there is no problem because it is the same computer so the run mode (as client or in container it is not a problem). But if I run tests against a remote container then a new problem comes. If I run tests in container, the events (for example BeforeSuite) are fired and I will be able to check if MongoDB is installed and run it. But if I run as client then no events are thrown and there is no way to start MongoDB on container side.

My question is, have you thought about this scenario in arquillian spacelift? I have thought one workaround which is creating a WebListener and deploy it with the application as well, but it is a hack that I am not pretty sure to do in this case.

Maybe another possibility is to only add support for embed and managed lifecycle.

WDYT?

kpiwko commented 10 years ago

That's really an interesting idea.

While you can for sure execute Spacelift related code in container, I'm not sure whether container would allow access to ProcessBuilder and such stuff due to security concerns.

If security is not a concern, it should be pretty easy to package Spacelift into Arquillian RemoteExtension, add it to the deployment and execute code in Container.

lordofthejars commented 10 years ago

But if test is run as client, how code will be executed? I thought that when test is run as client it is only used Arquillian on client side (no events on container side).

smiklosovic commented 10 years ago

@lordofthejars why do you depend on events from Arquillian itself? Why not to write your "check-installed-db" logic and put it directly in @BeforeClass JUnit method? That method would get executed in every case, both in-container and remote mode, right?

lordofthejars commented 10 years ago

Yes I was thinking the same but my initial idea was something more "automatic", I mean I add the extension as dependency and I don't have to worry anymore about having to copy paste same logic across all tests that requires a MongoDB. Maybe another "workaround" could be creating a mix test but not sure it is a clean way to do it.

2014-06-04 16:57 GMT+02:00 Štefan Miklošovič notifications@github.com:

@lordofthejars https://github.com/lordofthejars why do you depend on events from Arquillian itself? Why not to write your "check-installed-db" logic and put it directly in @BeforeClass JUnit method? That method would bet executed in every case, both in-container and remote mode, right?

— Reply to this email directly or view it on GitHub https://github.com/arquillian/arquillian-spacelift/issues/9#issuecomment-45101231 .

+----------------------------------------------------------+ Alex Soto Bueno - Computer Engineer www.lordofthejars.com +----------------------------------------------------------+

kpiwko commented 10 years ago

@lordofthejars so, you want to create an extension that would ensure there is MongoDB running, no matter whether your test is running against embedded, managed or remote container, right?

In such case I'd bind to container related events. Or you can create a MongoDB container

lordofthejars commented 10 years ago

Yes well I want to write an extension that checks if Mongo is installed somewhere (if not then download it and install it using spacelift), and then start and stop MongoDB.

2014-06-04 17:03 GMT+02:00 Karel Piwko notifications@github.com:

@lordofthejars https://github.com/lordofthejars so, you want to create an extension that would ensure there is MongoDB running, no matter whether your test is running against embedded, managed or remote container, right?

— Reply to this email directly or view it on GitHub https://github.com/arquillian/arquillian-spacelift/issues/9#issuecomment-45102031 .

+----------------------------------------------------------+ Alex Soto Bueno - Computer Engineer www.lordofthejars.com +----------------------------------------------------------+