Class: OpsManagerUiDrivers::Version17::ProductStatusHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/ops_manager_ui_drivers/version17/product_status_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(product_name:, browser:) ⇒ ProductStatusHelper

Returns a new instance of ProductStatusHelper.



4
5
6
7
# File 'lib/ops_manager_ui_drivers/version17/product_status_helper.rb', line 4

def initialize(product_name:, browser:)
  @product_name = product_name
  @browser      = browser
end

Instance Method Details

#az_name_for_job_in_az(job_name, vpc_id, az_guid) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/ops_manager_ui_drivers/version17/product_status_helper.rb', line 42

def az_name_for_job_in_az(job_name, vpc_id, az_guid)
  job_status = job_status_in_az("#{job_name}-partition-#{az_guid}", az_guid)

  job_ip = job_status.ips.fetch(0)

  ec2 = ::AWS::EC2.new  # creds initialized in TestSettings::Renderer::SettingsFetcher::AWSSettings.initialize

  found_instance = ec2.instances.find do |instance|
    instance.private_ip_address == job_ip && instance.vpc_id == vpc_id && instance.status == :running
  end

  found_instance.availability_zone if found_instance
end

#job_status(job_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ops_manager_ui_drivers/version17/product_status_helper.rb', line 9

def job_status(job_name)
  open_page

  wait_for_loading_indicator_to_disappear

  browser.within "##{product_name}-status" do
    job_row = browser.find(:css, "tr[data-ip-name ^= '#{job_name}']")

    Version17::JobStatusHelper.from_job_row(job_row)
  end
end

#job_status_in_az(job_name, az_guid) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ops_manager_ui_drivers/version17/product_status_helper.rb', line 21

def job_status_in_az(job_name, az_guid)
  open_page

  wait_for_loading_indicator_to_disappear

  browser.within "##{product_name}-#{az_guid}-status-table" do
    job_row = browser.find(:css, "tr[data-ip-name ^= '#{job_name}']")

    Version17::JobStatusHelper.from_job_row(job_row)
  end
end

#resource_pool_for_job_in_az(job_name, az_guid, vsphere_connection) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/ops_manager_ui_drivers/version17/product_status_helper.rb', line 33

def resource_pool_for_job_in_az(job_name, az_guid, vsphere_connection)
  job_status = job_status_in_az("#{job_name}-partition-#{az_guid}", az_guid)

  job_ip = job_status.ips.fetch(0)

  vm = vsphere_connection.searchIndex.FindByIp(ip: job_ip, vmSearch: true)
  vm.resourcePool.name
end