Commit graph

808 commits

Author SHA1 Message Date
Glenn Sarti
fb6be8e079 (POOLER-73) Add spec tests for remove_vmpooler_migration_vm
Add spec tests for remove_vmpooler_migration_vm
2017-02-17 15:51:04 -08:00
Glenn Sarti
a4c55d5bf4 (POOLER-73) Add spec tests for migration_limit
Add spec tests for migration_limit
2017-02-17 15:51:04 -08:00
Glenn Sarti
925071be79 (POOLER-73) Add spec tests for migrate_vm
Add spect tests for migrate_vm
2017-02-17 15:51:04 -08:00
Glenn Sarti
713e202d68 (POOLER-73) Add spec tests for revert_vm_snapshot
Add spec tests for revert_vm_snapshot
2017-02-17 15:51:04 -08:00
Glenn Sarti
e6be5bfb75 (POOLER-73) Add spec tests for create_vm_snapshot
Add spec tests for create_vm_snapshot
2017-02-17 15:51:04 -08:00
Glenn Sarti
6f79c438c7 (POOLER-73) Add spec tests for create_vm_disk
Add spec tests for create_vm_disk
2017-02-17 15:51:04 -08:00
Glenn Sarti
943d3025d1 (POOLER-73) Remove #_stats_running_ready tests
This commit removes the #_stats_running_ready tests as they are covered in the
_check_pool tests.
2017-02-17 15:51:04 -08:00
Glenn Sarti
15d4dfa64a (POOLER-73) Add spec tests for _check_pool
Add spec tests for _check_pool
2017-02-17 15:51:04 -08:00
Glenn Sarti
64d2d95ab3 (POOLER-73) Remove #move_running_to_completed tests
The tests for #move_running_to_completed are already tested in the
2017-02-17 15:51:03 -08:00
Glenn Sarti
daad5c7086 (POOLER-73) Add spec tests for check_pool
Add spec tests for check_pool

Previously the check_pool method would execute the loop indefinitely as it did not
have a terminating condition.  This made it impossible to test.  This commit
modifies the check_pool method so that it can take a maxloop and delay parameter
so that it can be tested.
2017-02-17 15:51:03 -08:00
Glenn Sarti
5e46ace584 (POOLER-73) Add spec tests for execute!
Add spec tests for execute!

Previously the execute! method would execute the loop indefinitely as it did not
have a terminating condition.  This made it impossible to test.  This commit
modifies the execute! method so that it can take a maxloop and delay parameter
so that it can be tested.
2017-02-17 15:51:03 -08:00
Glenn Sarti
e342cfe56a (POOLER-73) Add spec tests for get_vm_host_info
Add spec tests for get_vm_host_info
2017-02-17 15:51:03 -08:00
Glenn Sarti
14c091383c (POOLER-73) Add spec tests for destroy_vm
Add spec tests for destroy_vm
2017-02-17 15:51:03 -08:00
Glenn Sarti
434ab546a2 (POOLER-73) Add spec tests for clone_vm
Add spec tests for clone_vm
2017-02-17 15:51:03 -08:00
Glenn Sarti
9d8b792c4a (POOLER-73) Add spec tests for move_vm_queue
Add spec tests for move_vm_queue
2017-02-17 15:51:03 -08:00
Glenn Sarti
cb4e1400aa (POOLER-73) Modify spec tests for _check_running_vm
Modify spec tests for _check_running_vm
2017-02-17 15:51:03 -08:00
Glenn Sarti
58175dec47 (POOLER-73) Add spec tests for check_running_vm
Add spec tests for check_running_vm
2017-02-17 15:51:03 -08:00
Glenn Sarti
2475f55103 (POOLER-73) Add spec tests for check_ready_vm
Add spec tests for check_ready_vm
2017-02-17 15:51:03 -08:00
Glenn Sarti
8ae6b29be3 (POOLER-73) Modify spec tests for move_pending_vm_to_ready
Modify spec tests for move_pending_vm_to_ready
2017-02-17 15:51:02 -08:00
Glenn Sarti
4b2ca49e02 (POOLER-73) Modify spec tests for fail_pending_vm
Modify spec tests for fail_pending_vm
2017-02-17 15:51:02 -08:00
Glenn Sarti
b5ec74bae9 (POOLER-73) Add spec tests for remove_nonexistent_vm
Add spec tests for remove_nonexistent_vm
2017-02-17 15:51:02 -08:00
Glenn Sarti
9fdb51eb00 (POOLER-73) Modify spec tests for _check_pending_vm
(POOLER-73) Modify spec tests for _check_pending_vm
2017-02-17 15:51:02 -08:00
Glenn Sarti
b72275b552 (POOLER-73) Add spec tests for open_socket
Add spec tests for open_socket
2017-02-17 15:51:02 -08:00
Glenn Sarti
af9ec66b78 (POOLER-73) Add spec tests for check_pending_vm
Add spec tests for check_pending_vm
2017-02-17 15:51:02 -08:00
Glenn Sarti
a9fc1bb8aa (POOLER-73) Update test helpers
This commit adds the following test helpers:
- MockFindFolder
  Returns an mock result object from calling `Vmpooler::VsphereHelper.find_folder(foldername)`
- Use MockRedis instead of using method stubs
- MockLogger
  Creates an object which looks like the VMPooler::Logger object but just
  ignores all messages.  This stops the proliferation of allow(logger).to ....
  expectations in tests
- create_completed_vm
  Creates the required redis information for a completed VM
- create_discovered_vm
  Creates the required redis information for a newly discovered VM
- snapshot_revert_vm
  Creates the required redis information to revert a snapshot for a VM
- disk_task_vm
   Creates the required redis information to add a disk addition task to a VM
2017-02-17 15:51:02 -08:00
Glenn Sarti
8bcf74872a (POOLER-73) Restructure tests to unit and integration directories
Previously all of the spec tests for VM Pooler were all together in the specs
directory.  However some tests require a working local Redis server to operate
and other instead mock all external dependencies.  This commit splits the test
files between unit and integration, where integration tests require a working
Redis instance, and unit tests do not.  This commit also removes the root
`vmpooler` directory as it is not required.  The tests rake test still operates
correctly.

This commit also adds the mock_redis library for testing for the pool_manager.
2017-02-17 13:04:38 -08:00
Glenn Sarti
36310e381a (maint) Add rubocop checks to Travis
This commit adds rubocop checks to Travis for PR CI.  Any rubocop failures will
not fail the build yet.  Fixes for rubocop violations will happen in later
commits.
2017-02-10 13:33:36 -08:00
Glenn Sarti
85a2fa4f20 (maint) Add rubocop for testing
This commit adds the rubocop gem, a rubocop rake task and an initial rubocop
configuration file in prepartion for using rubocop in CI.

This commit also adds a rubocop todo file that exempts existing files from
violations.
2017-02-10 13:33:36 -08:00
Rob Braden
d67db2d380 Merge pull request #180 from glennsarti/ticket/maint/add-dummy-auth
(POOLER-71) Add dummy authentication provider
2017-02-09 16:44:26 -08:00
Ryan McKern
eb67ccad5a (POOLER-71) dummy auth only works in debug mode
If a user attempts to start vmpooler using dummy authentication
without setting the environment variable VMPOOLER_DEBUG, the vmpooler
will now refuse to start.
2017-02-09 16:27:10 -08:00
Glenn Sarti
2c74f4fa3a (POOLER-71) Add dummy authentication provider
Previously it was difficult to do local development as VMPooler requires an LDAP
service for authentication. This commit adds a dummy authentication provider.
The provider has passes authentication if the username and password are
different, and fails if the username and password are the same.  This commit
also updates the documentation in the config YML file.
2017-02-09 16:23:10 -08:00
Rick Sherman
71a5af9e88 Merge pull request #177 from glennsarti/ticket/maint/update-pooler-dev
(maint) Enhance VM Pooler developer experience
2017-02-09 14:38:39 -06:00
Glenn Sarti
8f294c055e (maint) Enable Ctrl-C to kill all threads in developer environment
Previously, if you ran the vpooler via ruby, pressing Ctrl-C would terminate the
Webserver however the PoolManager does not have a handler and would instead
just keep executing.  This commit adds a global Ctrl-C hook which terminates
both the api and manager threads.  This behaviour will only be enabled if the
`VMPOOLER_DEBUG` environment variable exists so that it does not affect VMPooler
when running in production environments.
2017-02-08 17:35:58 -08:00
Glenn Sarti
80c0742e80 (maint) Update Gemfile and gitignore
Previously, a bundle install would not pull in gems from Gemfile.local or
~/.gemfile which are common development workflows in Puppet.  This commit
modifies the Gemfile to pull in these additional gemfiles if they exist.  This
commit also adds common files and folders to gitignore which should not be
committed to this repository.
2017-02-08 17:35:58 -08:00
Michael Stahnke
1fa1909986 Merge pull request #178 from glennsarti/master
(maint) Remove Ruby 1.9.3 testing from Travis
2017-01-31 17:12:17 -06:00
Glenn Sarti
926eb47940 (maint) Remove Ruby 1.9.3 testing from Travis
Ruby 1.9.3 is end of life, and now longer bundles due to later Nokogiri 1.7.0.1
requiring Ruby 2.1 or above.  This commit removes ruby 1.9.3 from Travis
testing.
2017-01-24 14:59:14 -08:00
Rick Bradley
2bf7c4a715 Merge pull request #169 from sschneid/dockerfile
Containerize vmpooler
2016-12-20 13:43:51 -06:00
Scott Schneider
8105503b99 Remove outdated line about template configuration 2016-12-20 10:55:12 -08:00
Scott Schneider
d85f84011f Add instructions for running in a Docker container 2016-12-20 10:54:09 -08:00
Scott Schneider
833e34ce37 Update Dockerfile to move Gemflie*
...instead of Gemfile and Gemfile.lock (if it exists) individually
2016-12-20 10:45:36 -08:00
Scott Schneider
efe21b27cd Allow configuration to be defined in an ENV var
If `ENV['VMPOOLER_CONFIG']` is defined, it is read in as a YAML
configuration.  This allows vmpooler to run in a docker daemon via
`docker run -e VMPOOLER_CONFIG -p 80:4567 -it vmpooler` rather than
embedding a YAML file within the container.
2016-12-20 10:41:45 -08:00
Rick Bradley
1bbd623609 Merge pull request #174 from mattkirby/pooler_48
(POOLER-48) Clear migrations at application start time
2016-12-01 16:40:58 -06:00
wayne
b1d1b6f5b7 Merge pull request #175 from mattkirby/send_clone_errors_up
(POOLER-47) Send clone errors up
2016-12-01 13:40:55 -08:00
kirby@puppetlabs.com
fdc30f44bf Remove duplicate log for check_pool completed VMs 2016-12-01 13:36:57 -08:00
kirby@puppetlabs.com
f859826c65 (POOLER-47) Send clone errors up
This commit updates vmpooler to ensure clone errors, and other pool manager errors are raised to the parent method. Without this change vmpooler gets stuck after a connection fails during clone operations and will not attempt to clone again.
2016-12-01 12:41:01 -08:00
kirby@puppetlabs.com
bf8fb1850e (POOLER-48) Clear migrations at application start time
This commit updates vmpooler to clear the migrations queue at application start time. When the application is shut down it is not considerate of any activities, like migrations, in flight. The result is that when the application is started again any stale entries in vmpooler__migration will be left until manually removed, which can prevent migrations from occurring.
2016-12-01 09:58:29 -08:00
Rob Braden
2d6e5b3a8f Merge pull request #170 from sschneid/fix_dashboard_js_error
Fix JavaScript error on nil `weekly_data`
2016-11-29 15:17:09 -08:00
Rob Braden
e7a71c1088 Merge pull request #171 from sschneid/puma_gem
Add `puma` as required gem
2016-11-29 15:16:43 -08:00
Rob Braden
b7c370f064 Merge pull request #173 from mattkirby/retry_logic
Add retry logic with a delay for vsphere connections
2016-11-29 15:16:08 -08:00
kirby@puppetlabs.com
86aedd0754 Add retry logic with a delay for vsphere connections
This commit adds retry logic and configurable delays to vsphere helper.
Without this change vmpooler instances that have large numbers of pools
can create enough connections in a short period of time to cause vcenter
issues.
2016-11-29 03:43:18 -08:00