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

Async container testing #4

Open
tlovett1 opened this issue Feb 26, 2015 · 13 comments
Open

Async container testing #4

tlovett1 opened this issue Feb 26, 2015 · 13 comments

Comments

@tlovett1
Copy link
Owner

This will help Dockunit finish much faster.

@jdarling
Copy link
Contributor

I'm guessing this won't be as simple as just using async to wrap the calls. But I'll take a look.

@jdarling
Copy link
Contributor

Requires creating a local image from the disk. Then executing that image instead of running interactive from the local directory. Each container definition would require its own locally named image. This will stop the on disk collisions caused by things like npm install.

@jdarling
Copy link
Contributor

After the above its as simple as changing Containers.prototype.run to as follows:

Containers.prototype.run = function(finishedCallback, containerId) {
  var returnCodes = [], complete = 0, numberToRun = this.containers.length;
  function done(code){
    returnCodes.push(code);
    complete++;
    if(complete === numberToRun){
      return finishedCallback(returnCodes);
    }
  };
  this.containers.forEach(function(container){
    container.run(done);
  });
};

@jdarling
Copy link
Contributor

One way of doing this would be to change the way things work, something more along the lines of:

Mount source folder to /app/src
Copy /app/src to /app/test
Change to /app/test
Run setup scripts
Run tests
Clean exit letting Docker worry about removal of /app/test

@tlovett1
Copy link
Owner Author

I feel like is similar to what we're doing (your last comment)? The tricky part of this is running out of disk space/memory. If someone tries to run a couple containers at once, everything could fail as memory runs out. I think we need some sort of fail safe for that.

@jdarling
Copy link
Contributor

Yes, limits would have to be put in place. Writing something like Async's eachLimit is simple enough, but honestly I'd suggest just bringing in Async and using it. First though would be to abstract away and refactor a lot of the (currently) embedded bits for a bit easier modification. I'll take a look at it some more when I get time, have to retrain my editor to your standards :D

@tlovett1
Copy link
Owner Author

Ok, I'm not super familiar with Async. Would love any help you could provide. Sorry about the editor!

@jdarling
Copy link
Contributor

So, after looking at Dockunit and how to pull this off it was easier (for me at least) to build a separate ES6 wrapper around Docker to make this possible (https://github.com/jdarling/rouster). I'd like to put together a PR that incorporates rouster to do the calling out to docker and then adds in all the functionality of dockunit. Pain point, for me at least, is reconfiguring my editor to fit your coding standards, so it might be a day or two before I get it all done.

Sound good, or would you rather not go that far?

@tlovett1
Copy link
Owner Author

Would love to see a PR. Feel free to add an .editorconfig and just force code to your editor.

@jdarling
Copy link
Contributor

What do you use for your .editorconfig? Judging from what I can grok something similar to as follows:

[*]
end_of_line = crlf
insert_final_newline = true

[*.{js}]
charset = utf-8

[lib/**.js]
indent_style = tab
indent_size = 8

@tlovett1
Copy link
Owner Author

Indent size is 4. I think the rest is correct. Feel free to commit an .editorconfig file.

@jdarling
Copy link
Contributor

Yep, will do when I commit the other changes ;)

@jdarling
Copy link
Contributor

PR that closes this submitted. Tons of work in there ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants