(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
This commit is contained in:
Glenn Sarti 2017-02-13 11:06:36 -08:00
parent 8bcf74872a
commit a9fc1bb8aa
2 changed files with 45 additions and 2 deletions

View file

@ -3,8 +3,8 @@ require 'time'
require 'mock_redis'
describe 'Pool Manager' do
let(:logger) { double('logger') }
let(:redis) { double('redis') }
let(:logger) { MockLogger.new }
let(:redis) { MockRedis.new }
let(:metrics) { Vmpooler::DummyStatsd.new }
let(:config) { {} }
let(:pool) { 'pool1' }