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

Use Docker instances of VoltDB for testing. #29

Merged
merged 7 commits into from
Dec 15, 2017

Conversation

mattyouill
Copy link
Contributor

@mattyouill mattyouill commented Sep 20, 2017

Change the test cases to query Docker for the port Volt is exposed on.
Change the ddl to tear down the test Volt schema before setting it up.
Change the run script to query Docker for the port Volt is exposed on.

The objective is to:

  • Be able to test against different versions/setups of volt more easily - can test against various volt docker images instead of being restricted to whatever volt instance is running locally.
  • Not need to rely on VMs for testing. Docker is a bit lighter.
  • Obviate need to mess around with local machine settings - like fiddling with THP settings.

Have tried to change existing code as little as possible for now, but will need a tidy up/refactor in future.

Change the ddl to tear down the test Volt schema before setting it up.
Change the run script to query Docker for the port Volt is exposed on.
* which port the container's 21212 port has been exposed on. Intended to be used
* with the localhostcluster docker containers defined in the main volt repository.
*/
function _getExposedVoltPort(containerName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of throwing an error, this can return the default port number in case docker is not running or is not used for testing.

#$VOLTDB init -C deployment.xml -f -j $APPNAME.jar -s ddl.sql
#$VOLTDB start

PORT=`docker port node1 21212 | cut -d: -f2`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the comment made above, I think it'll be more friendly to fallback to starting a local VoltDB process if docker is either not running or not installed.

…after.

As far as getting a Volt instance setup and ready for testing against:

- It now defaults to starting a local Volt instance if it can't find a running Docker instance
- If it does find a running docker instance it will use that

On the testing side:

- You can configure the preferred way to run the tests, but it defaults to using a local instance
- You can override this by passing a cli option of -i docker to use docker.

(Having the tests automagically search for a usable Volt instance gives me the heebie jeebies a bit... I know I switch between projects a lot and am a bit apprehensive about the tests running against a wrong instance). Hopefully it now supporting both ways (via switches) is a usable compromise?

Some extra things...

Have begun to add some linting
Added nvm - minimum node version already quite out of date
Some naming hygiene
Run tests and lint from npm - still awkward but getting there
…length" error. Can only really guess what is triggering it given the sketchy details but the test case tries to replicate what is described in the VoltDB#18 issue. (VoltDB#28)

Also contains some experimental promise based wrappers around the call back style fns in VoltClient... plus an eslint config.
@mattyouill
Copy link
Contributor Author

Hi @nshi Should be OK to go now, take a look and let me know if you need some more changes. Messed up this merge a bit, was in a rush, hopefully I've tidied it up for you.

…after.

As far as getting a Volt instance setup and ready for testing against:

- It now defaults to starting a local Volt instance if it can't find a running Docker instance
- If it does find a running docker instance it will use that

On the testing side:

- You can configure the preferred way to run the tests, but it defaults to using a local instance
- You can override this by passing a cli option of -i docker to use docker.

(Having the tests automagically search for a usable Volt instance gives me the heebie jeebies a bit... I know I switch between projects a lot and am a bit apprehensive about the tests running against a wrong instance). Hopefully it now supporting both ways (via switches) is a usable compromise?

Some extra things...

Have begun to add some linting
Added nvm - minimum node version already quite out of date
Some naming hygiene
Run tests and lint from npm - still awkward but getting there
Fix: Missing test context in buffer test
Fix: Test for Volt docker instance in schema setup script

Change: Return default Volt port when no Docker container found running volt
@mattyouill
Copy link
Contributor Author

Found some time to go back and double check these changes. Needed a few fixes, which I've pushed.

@nshi nshi merged commit 85745f5 into VoltDB:master Dec 15, 2017
@mattyouill mattyouill deleted the feature/docker-tests branch December 18, 2017 02:38
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