forked from ManageIQ/manageiq-providers-autosde
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstorage_manager_spec.rb
53 lines (42 loc) · 2.18 KB
/
storage_manager_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
describe ManageIQ::Providers::Autosde::StorageManager do
it 'type is autosde' do
expect(described_class.ems_type).to(eq('autosde'))
end
it "has credentials and hostname" do
ems = FactoryBot.create(:autosde_storage_manager, :with_authentication, :name => "kaka")
expect(described_class.all[0].name).to(eq('kaka'))
expect(ManageIQ::Providers::StorageManager.all[0].authentication_userid).to(eq("testuser"))
end
it "has autosde client" do
FactoryBot.create(:autosde_storage_manager, :with_authentication)
expect(ManageIQ::Providers::StorageManager.all[0].autosde_client).to(be_instance_of(ManageIQ::Providers::Autosde::StorageManager::AutosdeClient))
end
it "can get storage systems -autosde gem v1" do
# use special trait: with_autosde_credentials, to supply real credentials when first run
ems = FactoryBot.create(:autosde_storage_manager, :with_autosde_credentials, :hostname => Rails.application.secrets.autosde[:appliance_host])
VCR.use_cassette("get_storage_systems_from_storage_manager_v1") do
systems = ems.autosde_client.StorageSystemApi.storage_systems_get
expect(systems).to(be_an_instance_of(Array))
expect(systems.first.management_ip).to(be_truthy)
end
end
it "can get storage systems -autosde gem v2" do
# use special trait: with_autosde_credentials, to supply real credentials when first run
ems = FactoryBot.create(:autosde_storage_manager, :with_autosde_credentials, :hostname => Rails.application.secrets.autosde[:appliance_host])
VCR.use_cassette("get_storage_systems_from_storage_manager_v2", :record => :once) do
systems = ems.autosde_client.StorageSystemApi.storage_systems_get
expect(systems).to(be_an_instance_of(Array))
expect(systems.first.management_ip).to(be_truthy)
end
end
context "#pause!" do
let(:zone) { FactoryBot.create(:zone) }
let(:ems) { FactoryBot.create(:autosde_storage_manager, :zone => zone) }
include_examples "ExtManagementSystem#pause!"
end
context "#resume!" do
let(:zone) { FactoryBot.create(:zone) }
let(:ems) { FactoryBot.create(:autosde_storage_manager, :zone => zone) }
include_examples "ExtManagementSystem#resume!"
end
end