Skip to content

PR to allow shellCommand and containerLimit#12

Open
jdarling wants to merge 5 commits into
tlovett1:masterfrom
jdarling:master
Open

PR to allow shellCommand and containerLimit#12
jdarling wants to merge 5 commits into
tlovett1:masterfrom
jdarling:master

Conversation

@jdarling

Copy link
Copy Markdown
Contributor

This adds in support for shellCommand (for distros like Alpine that need a different shell command) and containerLimit to allow parallel execution of tests.

Ton's of refactor work in there. So much that I actually broke out the docker wrapper to its own npm module called rouster then re-wrapped everything back up into a nice package. Also brings in async to do some of the heavy lifting.

Lots of manual testing done, and I think I got the actual tests right, but there was so much refactor that some may still need to be re-written.

Also, version bump to 0.5.4 included.

Completely backward compatible.

Closes #4, #10, and #11

@tlovett1

Copy link
Copy Markdown
Owner

Just starting to test this. Two things:

  • Tests are failing
  • I think there are some character escaping issues within beforeScripts. Try running dockunit on this file: https://github.com/10up/ElasticPress/blob/develop/Dockunit.json. You will see this command fail: mysqladmin create wordpress_test --user=root '--password='\'''\''' --host=localhost --protocol=tcp. Notice the escaped single quotes.

Thanks for starting this!

@jdarling

Copy link
Copy Markdown
Contributor Author

Yeah I was afraid that there was going to be an issue with that regex. I'll take a look around and see what I can come up with for a better way. Will also take a look at ElasticPress and see if I can get it working.

@jdarling

Copy link
Copy Markdown
Contributor Author

Now that I have fixed rouster, I'll go back to this PR and fix it for ElasticPress. Any other projects you can point to that would be good to test with?

@jdarling

Copy link
Copy Markdown
Contributor Author

And I see the issue, they have '' (two single quotes side by side) and the regex for command line parsing is looking for there to be at least something between them.

cmd.match(/"[^"]+"|'[^']+'|[^ \t]+/g);

Switching it to 0 or more seems to resolve this:

return cmd.match(/"[^"]*"|'[^']*'|[^ \t]+/g);

Also had to add in some logic to remove those hard embedded 's and "s since they are put back in for you by the shell exec command when you use its array form. The code is a little dirty right now, but it works locally.

Doing some more testing and then will update the PR.

@jdarling

Copy link
Copy Markdown
Contributor Author

Code coverage is what is failing on the tests, still have to fix that :D

@tlovett1

Copy link
Copy Markdown
Owner

Here is another test Dockunit file - https://github.com/tlovett1/custom-contact-forms/blob/master/Dockunit.json

@jdarling

Copy link
Copy Markdown
Contributor Author

Cool, so with the latest changes I get the same results for the current codebase as I do the new code base that uses rouster and I can run it in parallel (limit 3) on all 3 test cases I have with no issues.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants