Commit graph

44 commits

Author SHA1 Message Date
Glenn Sarti
8c421aa3bd (POOLER-70) Update check_ready_vm for VM Provider
Previously the Pool Manager would use vSphere objects directly.  This commit
- Modifies the pool_manager to use the VM provider methods instead
- Splits the check_ready_vm function into two.  One function spawns the thread
  while the other actually does the work.  This makes testing much easier.
2017-05-17 13:52:27 -07:00
Glenn Sarti
760dc1c67e (POOLER-70) Update move_pending_vm_to_ready for VM Provider
Previously the Pool Manager would use vSphere objects directly.  This commit
- Modifies the pool_manager to use the VM provider methods instead
2017-05-17 13:52:27 -07:00
Glenn Sarti
9f4fc903b9 (POOLER-70) Update fail_pending_vm for VM Provider
Previously the Pool Manager would use vSphere objects directly.  This commit
- Modifies the pool_manager to use the VM provider methods instead
- Modified to return true or false to indicate that the VM was failed
2017-05-17 13:52:27 -07:00
Glenn Sarti
199bf4a070 (POOLER-70) Update check_pending_vm for VM Provider
Previously the Pool Manager would use vSphere objects directly.  This commit
- Modifies the pool_manager to use the VM provider methods instead
- Removes the open_socket method and tests as it is only required in the vSphere
  VM provider
2017-05-17 13:52:27 -07:00
Glenn Sarti
5aa5019822 (POOLER-70) Add mock provider test fixture
This commit creates a VM Provider test fixture for spec tests that merely uses
the Base Provider class with a name of mock_provider.  This will then be used
by unit tests in further commits.
2017-05-17 13:52:27 -07:00
Glenn Sarti
ac8a34de86 (POOLER-70) Rename the use of vsphere to provider
VM provisioning will be handled by VM Providers.  This commit renames the use of
vsphere to provider where appropriate and changes the per-pool helper from
vsphere to providers to more accurately represent it's intended use.
2017-03-08 17:14:52 -08:00
Morgan Rhodes
850919f5db Merge pull request #189 from glennsarti/ticket/maint/rename-moves-and-clonevm
(POOLER-70) Refactor clone_vm to take pool configuration object
2017-03-02 11:39:29 -08:00
Glenn Sarti
ac7d7009d2 (POOLER-70) Refactor clone_vm to take pool configuration object
Previously, the clone_vm method took various VSphere specific parameters e.g.
template folder.  However in order make VMPooler less VSphere specific this
method should just take the pool configuration and then it can determine the
appropriate settings itself.  This commit also moves the threading to a clone_vm
while the actual method which does the work is now _clone_vm as per all other
multithread worker methods in pool_manager.  This commit also updates the spec
tests appropriately.
2017-03-01 21:53:42 -08:00
Glenn Sarti
f433056734 (GH-185) Remove unnecessary checks in check_ready_vm
Previously in check_ready_vm, if the VM is powered off, the VM is moved in
redis however the function doesn't return there, and instead then checks if the
hostname is the same, and then if TCP socket 22 is open. This is unnecessary as
we already know the VM is turned off so of course the hostname is wrong and TCP
22 is unavailable. The same applies for the VM hostname.

This commit instead returns after it is found a VM is no longer ready.  This
commit also amends the spec tests for the correct behaviour.
2017-03-01 20:28:36 -08:00
Glenn Sarti
e783e93784 (POOLER-73) Modify spec tests for _migrate_vm
Modify spec tests for _migrate_vm
2017-02-17 15:51:05 -08:00
Glenn Sarti
c69d61107f (POOLER-73) Modify spec tests for _revert_vm_snapshot
Modify spec tests for _revert_vm_snapshot
2017-02-17 15:51:05 -08:00
Glenn Sarti
b63822fa9f (POOLER-73) Modify spec tests for _create_vm_snapshot
Modify spec tests for _create_vm_snapshot
2017-02-17 15:51:05 -08:00
Glenn Sarti
0a6dffbd05 (POOLER-73) Add spec tests for _create_vm_disk
Add spec tests for _create_vm_disk
2017-02-17 15:51:05 -08:00
Glenn Sarti
3083186241 (POOLER-73) Add spec tests for _check_disk_queue
Add spec tests for _check_disk_queue
2017-02-17 15:51:05 -08:00
Glenn Sarti
25ad5d58f7 (POOLER-73) Add spec tests for _check_snapshot_queue
Add spec tests for _check_snapshot_queue
2017-02-17 15:51:05 -08:00
Glenn Sarti
6f127d32bc (POOLER-73) Add spec tests for check_snapshot_queue
Add spec tests for check_snapshot_queue

Previously the check_snapshot_queue 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_snapshot_queue method so that it can take a
maxloop and delay parameter so that it can be tested.
2017-02-17 15:51:05 -08:00
Glenn Sarti
4dd0c96a78 (POOLER-73) Add spec tests for check_disk_queue
Add spec tests for check_disk_queue

Previously the check_disk_queue 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_disk_queue method so that it can take a maxloop and
delay parameter so that it can be tested.
2017-02-17 15:51:04 -08:00
Glenn Sarti
47d597f68a (POOLER-73) Add spec tests for migrate_vm_and_record_timing
Add spec tests for migrate_vm_and_record_timing
2017-02-17 15:51:04 -08:00
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
Renamed from spec/vmpooler/pool_manager_spec.rb (Browse further)