Revision bd95cda6
Added by Dominic Cleal about 8 years ago
test/unit/compute_resource_test.rb | ||
---|---|---|
test '.providers returns merge of loaded builtin and registered providers' do
|
||
ComputeResource.expects(:registered_providers).returns({'Libvirt' => 'Best::Provider::Libvirt', 'MyBest' => 'Best::Provider::MyBest'})
|
||
ComputeResource.expects(:supported_providers).returns({'Libvirt' => 'Foreman::Model::Libvirt', 'EC2' => 'Foreman::Model::EC2', 'GCE' => 'Foreman::Model::GCE'})
|
||
SETTINGS.expects(:[]).with(:libvirt).returns(true)
|
||
SETTINGS.expects(:[]).with(:ec2).returns(true)
|
||
SETTINGS.expects(:[]).with(:gce).returns(false)
|
||
Fog::Compute.expects(:providers).twice.returns([:aws, :libvirt])
|
||
assert_equal(
|
||
{
|
||
'EC2' => 'Foreman::Model::EC2',
|
Also available in: Unified diff
fixes #14415 - check CR availability with Fog, not SETTINGS
Simplifies the code for checking compute resource availability, which
can easily be determined with the registered Fog providers instead of
being stored in SETTINGS in app initialisation. Plugins should always be
loaded, so should not need to override this class method.