def test_list_provider_server_groups(provider): """Tests server groups lists from current Provider between UI, DB and Management system Steps: * Get domains list from UI of provider * Chooses one of domains * Get server groups list from UI of domain * Get server groups list from Database of domain * Get server groups list from Management system(Hawkular) * Get headers from UI * Compare headers from UI with expected headers list * Compare content of all the list [UI, Database, Management system] """ domain_list = MiddlewareDomain.domains(provider=provider) for domain in get_random_list(domain_list, 1): ui_server_groups = get_server_group_set( MiddlewareServerGroup.server_groups(domain=domain)) db_server_groups = get_server_group_set( MiddlewareServerGroup.server_groups_in_db(domain=domain)) mgmt_server_groups = get_server_group_set( MiddlewareServerGroup.server_groups_in_mgmt(domain=domain)) headers = MiddlewareServerGroup.headers(domain) headers_expected = ['Server Group Name', 'Feed', 'Domain Name', 'Profile'] assert headers == headers_expected assert ui_server_groups == db_server_groups == mgmt_server_groups, \ ("Lists of server groups mismatch! UI:{}, DB:{}, MGMT:{}" .format(ui_server_groups, db_server_groups, mgmt_server_groups))
def test_server_group_details(provider): """Tests server group details on UI Steps: * Get domains list from UI of provider * Chooses one of domains * Get server groups list from UI of domain * Chooses several server groups from list * Select each server group's details in UI, DB and MGMT * Compare selected server group UI details with CFME database and MGMT system """ domain_list = MiddlewareDomain.domains(provider=provider) for domain in get_random_list(domain_list, ITEMS_LIMIT): server_group_list = MiddlewareServerGroup.server_groups(domain=domain) for server_group in get_random_list(server_group_list, 1): svgr_ui = server_group.server_group(method='ui') svgr_db = server_group.server_group(method='db') svgr_mgmt = server_group.server_group(method='mgmt') assert svgr_ui, "Server Group was not found in UI" assert svgr_db, "Server Group was not found in DB" assert svgr_mgmt, "Server Group was not found in MGMT system" assert svgr_ui.name == svgr_db.name == svgr_mgmt.name, \ ("Server Group name does not match between UI:{}, DB:{}, MGMT:{}" .format(svgr_ui.name, svgr_db.name, svgr_mgmt.name)) svgr_db.validate_properties() svgr_mgmt.validate_properties()
def get_random_domain(provider, load_from="db"): load_from = load_from.lower() if load_from == "ui": domains = MiddlewareDomain.domains(provider=provider) elif load_from == "db": domains = MiddlewareDomain.domains_in_db(provider=provider) elif load_from == "mgmt": domains = MiddlewareDomain.domains_in_mgmt(provider=provider) else: raise RuntimeError("Not supported option: '{}'".format(load_from)) assert len(domains) > 0, "There is no domain(s) available in {}".format(load_from) return get_random_list(domains, 1)[0]
def test_list_provider_domains(provider): """Tests domains lists from current Provider between UI, DB and Management system Steps: * Get domains list from UI of provider * Get domains list from Database of provider * Get domains list from Management system(Hawkular) * Compare content of all the list [UI, Database, Management system] """ ui_domains = get_domains_set(MiddlewareDomain.domains(provider=provider)) db_domains = get_domains_set(MiddlewareDomain.domains_in_db(provider=provider)) mgmt_domains = get_domains_set(MiddlewareDomain.domains_in_mgmt(provider=provider)) assert ui_domains == db_domains == mgmt_domains, \ ("Lists of domains mismatch! UI:{}, DB:{}, MGMT:{}" .format(ui_domains, db_domains, mgmt_domains))
def test_list_domains(): """Tests domains lists between UI, DB and Management system. Steps: * Get domains list from UI * Get domains list from Database * Get headers from UI * Compare headers from UI with expected headers list * Compare content of all the list [UI, Database, Management system] """ ui_domains = get_domains_set(MiddlewareDomain.domains()) db_domains = get_domains_set(MiddlewareDomain.domains_in_db()) mgmt_domains = get_domains_set(MiddlewareDomain.domains_in_mgmt()) headers = MiddlewareDomain.headers() headers_expected = ['Domain Name', 'Feed', 'Provider'] assert headers == headers_expected assert ui_domains == db_domains == mgmt_domains, \ ("Lists of domains mismatch! UI:{}, DB:{}, MGMT:{}" .format(ui_domains, db_domains, mgmt_domains))
def test_list_server_group_servers(provider): """Tests servers lists from server groups of domain and checks values between UI, DB and Management system Steps: * Get domains list from UI of provider * Chooses one of domains * Get server groups list from UI of domain * Get servers list from UI of each server group * Get servers list from Database of each server group * @TODO add support of checking in MGMT * Compare content of all the list [UI, Database] """ domain_list = MiddlewareDomain.domains(provider=provider) for domain in get_random_list(domain_list, 1): server_groups = MiddlewareServerGroup.server_groups(domain=domain) for server_group in server_groups: ui_servers = get_servers_set(MiddlewareServer.servers(server_group=server_group)) db_servers = get_servers_set(MiddlewareServer.servers_in_db(server_group=server_group)) assert ui_servers == db_servers, "Lists of servers mismatch! UI:{}, DB:{}".format(ui_servers, db_servers)
def test_domain_details(provider): """Tests domain details on UI Steps: * Get domains list from UI * Select each domain details in UI * Compare selected domain UI details with CFME database and MGMT system """ domain_list = MiddlewareDomain.domains(provider=provider) for domain in get_random_list(domain_list, 1): dmn_ui = domain.domain(method='ui') dmn_db = domain.domain(method='db') dmn_mgmt = domain.domain(method='mgmt') assert dmn_ui, "Domain was not found in UI" assert dmn_db, "Domain was not found in DB" assert dmn_mgmt, "Domain was not found in MGMT system" assert dmn_ui.name == dmn_db.name == dmn_mgmt.name, \ ("domain name does not match between UI:{}, DB:{}, MGMT:{}" .format(dmn_ui.name, dmn_db.name, dmn_mgmt.name)) dmn_db.validate_properties() dmn_mgmt.validate_properties()
def test_list_server_group_servers(provider): """Tests servers lists from server groups of domain and checks values between UI, DB and Management system Steps: * Get domains list from UI of provider * Chooses one of domains * Get server groups list from UI of domain * Get servers list from UI of each server group * Get servers list from Database of each server group * @TODO add support of checking in MGMT * Compare content of all the list [UI, Database] """ domain_list = MiddlewareDomain.domains(provider=provider) for domain in get_random_list(domain_list, 1): server_groups = MiddlewareServerGroup.server_groups(domain=domain) for server_group in server_groups: ui_servers = get_servers_set(MiddlewareServer.servers(server_group=server_group)) db_servers = get_servers_set(MiddlewareServer.servers_in_db(server_group=server_group)) assert ui_servers == db_servers, \ ("Lists of servers mismatch! UI:{}, DB:{}" .format(ui_servers, db_servers))
def get_random_domain(provider): domains = MiddlewareDomain.domains(provider=provider) assert len(domains) > 0, "There is no domains(s) available in UI" return get_random_list(domains, 1)[0]