def test_list_provider_server_deployments(provider): """Tests deployments list from current Provider for each server between UI, DB and Management system Steps: * Get Local server from UI of provider * Get deployments list for the server * Get deployments list from UI of provider, server * Get deployments list from Database of provider, server * Get deployments list from Database of provider, server * Get deployments list from Management system(Hawkular) of server * Compare size of all the list [UI, Database, Management system] """ server = get_hawkular_server(provider) ui_deps = get_deployments_set( MiddlewareDeployment.deployments(provider=provider, server=server)) db_deps = get_deployments_set( MiddlewareDeployment.deployments_in_db(provider=provider, server=server)) mgmt_deps = get_deployments_set( MiddlewareDeployment.deployments_in_mgmt(provider=provider, server=server)) assert ui_deps == db_deps == mgmt_deps, \ ("Lists of deployments mismatch! UI:{}, DB:{}, MGMT:{}" .format(ui_deps, db_deps, mgmt_deps))
def test_list_provider_server_deployments(provider): """Tests deployments list from current Provider for each server between UI, DB and Management system Steps: * Get servers list from UI of provider * Get deployments list for the server * Get deployments list from UI of provider, server * Get deployments list from Database of provider, server * Get deployments list from Database of provider, server * Get deployments list from Management system(Hawkular) of server * Compare size of all the list [UI, Database, Management system] """ servers = MiddlewareServer.servers(provider=provider) assert len(servers) > 0, "There is no server(s) available in UI" for server in get_random_list(servers, ITEMS_LIMIT): ui_deps = _get_deployments_set( MiddlewareDeployment.deployments(provider=provider, server=server)) db_deps = _get_deployments_set( MiddlewareDeployment.deployments_in_db(provider=provider, server=server)) mgmt_deps = _get_deployments_set( MiddlewareDeployment.deployments_in_mgmt(provider=provider, server=server)) assert ui_deps == db_deps == mgmt_deps, \ ("Lists of deployments mismatch! UI:{}, DB:{}, MGMT:{}" .format(ui_deps, db_deps, mgmt_deps))
def get_random_deployment(provider, load_from="db"): load_from = load_from.lower() if load_from == "ui": deployments = MiddlewareDeployment.deployments(provider=provider) elif load_from == "db": deployments = MiddlewareDeployment.deployments_in_db(provider=provider) elif load_from == "mgmt": deployments = MiddlewareDeployment.deployments_in_mgmt(provider=provider) else: raise RuntimeError("Not supported option: '{}'".format(load_from)) assert len(deployments) > 0, "There is no deployment(s) available in {}".format(load_from) return get_random_list(deployments, 1)[0]
def test_list_server_deployments(provider): """Tests deployments list for Hawkular Local server Steps: * Get Hawkular Local server * Get deployments list from UI of server * Get deployments list from Database of server * Compares both lists [UI, Database] """ server = get_server(provider, HAWKULAR_PRODUCT_NAME) ui_deps = get_deployments_set(MiddlewareDeployment.deployments(server=server)) db_deps = get_deployments_set(MiddlewareDeployment.deployments_in_db(server=server)) assert ui_deps == db_deps, "Lists of deployments mismatch! UI:{}, DB:{}".format(ui_deps, db_deps)
def test_list_deployments(): """Tests deployments list between UI, DB and management system Steps: * Get deployments list from UI * Get deployments list from Database * Compare size of all the list [UI, Database, Management system] """ ui_deps = _get_deployments_set(MiddlewareDeployment.deployments()) db_deps = _get_deployments_set(MiddlewareDeployment.deployments_in_db()) mgmt_deps = _get_deployments_set(MiddlewareDeployment.deployments_in_mgmt()) assert ui_deps == db_deps == mgmt_deps, \ ("Lists of deployments mismatch! UI:{}, DB:{}, MGMT:{}".format(ui_deps, db_deps, mgmt_deps))
def test_list_provider_deployments(provider): """Tests deployments list from current Provider between UI, DB and Management system Steps: * Get deployments list from UI of provider * Get deployments list from Database of provider * Get deployments list from Management system(Hawkular) * Compare size of all the list [UI, Database, Management system] """ ui_deps = _get_deployments_set(MiddlewareDeployment.deployments(provider=provider)) db_deps = _get_deployments_set(MiddlewareDeployment.deployments_in_db(provider=provider)) mgmt_deps = _get_deployments_set(MiddlewareDeployment.deployments_in_mgmt(provider=provider)) assert ui_deps == db_deps == mgmt_deps, \ ("Lists of deployments mismatch! UI:{}, DB:{}, MGMT:{}".format(ui_deps, db_deps, mgmt_deps))
def test_list_deployments(): """Tests deployments list between UI, DB and management system Steps: * Get deployments list from UI * Get deployments list from Database * Compare size of all the list [UI, Database, Management system] """ ui_deps = _get_deployments_set(MiddlewareDeployment.deployments()) db_deps = _get_deployments_set(MiddlewareDeployment.deployments_in_db()) mgmt_deps = _get_deployments_set( MiddlewareDeployment.deployments_in_mgmt()) assert ui_deps == db_deps == mgmt_deps, \ ("Lists of deployments mismatch! UI:{}, DB:{}, MGMT:{}".format(ui_deps, db_deps, mgmt_deps))
def test_topology_details(provider): """Tests items details in topology page from provider page Steps: * Get topology elements detail * Check details of `Servers`, `Domains`, `Messagings`, * `Datasources`, `Server Groups`, `Deployments` on topology page """ # reload topology page to make sure all elements are loaded provider.topology.reload() provider.topology.refresh() verify_elements_match(MiddlewareServer.servers_in_db(), provider.topology.elements(element_type='MiddlewareServer')) verify_elements_match(MiddlewareMessaging.messagings_in_db(), provider.topology.elements(element_type='MiddlewareMessaging')) verify_elements_match(MiddlewareDatasource.datasources_in_db(), provider.topology.elements(element_type='MiddlewareDatasource')) verify_elements_match(MiddlewareDomain.domains_in_db(), provider.topology.elements(element_type='MiddlewareDomain')) server_groups = [] for domain in MiddlewareDomain.domains_in_db(): server_groups.extend(MiddlewareServerGroup.server_groups_in_db(domain)) verify_elements_match(server_groups, provider.topology.elements(element_type='MiddlewareServerGroup')) deployments = provider.topology.elements(element_type='MiddlewareDeployment') deployments.extend(provider.topology.elements(element_type='MiddlewareDeploymentWar')) deployments.extend(provider.topology.elements(element_type='MiddlewareDeploymentEar')) verify_elements_match(MiddlewareDeployment.deployments_in_db(), deployments)
def test_list_server_deployments(): """Gets servers list and tests deployments list for each server Steps: * Get servers list from UI * Get deployments list from UI of server * Get deployments list from Database of server * Compare size of all the list [UI, Database] """ servers = MiddlewareServer.servers() assert len(servers) > 0, "There is no server(s) available in UI" for server in get_random_list(servers, ITEMS_LIMIT): ui_deps = _get_deployments_set(MiddlewareDeployment.deployments(server=server)) db_deps = _get_deployments_set(MiddlewareDeployment.deployments_in_db(server=server)) assert ui_deps == db_deps, \ ("Lists of deployments mismatch! UI:{}, DB:{}".format(ui_deps, db_deps))
def test_list_server_deployments(provider): """Tests deployments list for Hawkular Local server Steps: * Get Hawkular Local server * Get deployments list from UI of server * Get deployments list from Database of server * Compares both lists [UI, Database] """ server = get_hawkular_server(provider) ui_deps = get_deployments_set(MiddlewareDeployment.deployments( server=server)) db_deps = get_deployments_set(MiddlewareDeployment.deployments_in_db( server=server)) assert ui_deps == db_deps, \ ("Lists of deployments mismatch! UI:{}, DB:{}".format(ui_deps, db_deps))
def test_topology_server_hierarchy(provider): """Tests all server's hierarchical content in topology Steps: * Read Servers in topology. * For each server read elements in topology. * Compare elements from topology with server's elements from DB. """ # reload topology page to make sure all elements are loaded provider.topology.reload() provider.topology.refresh() for ui_server in provider.topology.elements( element_type='MiddlewareServer'): elements = [] server = MiddlewareServer.servers_in_db(name=ui_server.name)[0] elements.extend( MiddlewareDeployment.deployments_in_db(server, provider, strict=False)) elements.extend( MiddlewareDatasource.datasources_in_db(server, provider, strict=False)) elements.extend( MiddlewareMessaging.messagings_in_db(server, provider, strict=False)) verify_elements_included(elements, ui_server.children)
def get_deployment_from_list(provider, server, runtime_name): for deployment in MiddlewareDeployment.deployments(provider=provider, server=server): if deployment.name == runtime_name: return deployment raise ValueError( 'Recently deployed archive {} was not found in deployments list'. format(runtime_name))
def check_deployment_appears(provider, server, runtime_name): provider.refresh_provider_relationships(method='rest') wait_for(lambda: runtime_name in get_deployments_statuses( MiddlewareDeployment.deployments(provider=provider, server=server)), delay=30, num_sec=1200, message='Deployment {} must be found for server {}'.format( runtime_name, server.name))
def check_deployment_not_listed(provider, server, runtime_name): provider.refresh_provider_relationships(method='ui') wait_for(lambda: runtime_name not in get_deployments_statuses( MiddlewareDeployment.deployments(provider=provider, server=server)), delay=30, num_sec=1200, message='Deployment {} must not be found for server {}' .format(runtime_name, server.name))
def check_deployment_not_listed(provider, server, runtime_name): refresh(provider) wait_for(lambda: runtime_name not in get_deployments_statuses( MiddlewareDeployment.deployments(provider=provider, server=server)), delay=DELAY, num_sec=NUM_SECS, message='Deployment {} must not be found for server {}' .format(runtime_name, server.name), fail_func=lambda: refresh(provider))
def test_list_server_deployments(): """Gets servers list and tests deployments list for each server Steps: * Get servers list from UI * Get deployments list from UI of server * Get deployments list from Database of server * Compare size of all the list [UI, Database] """ servers = MiddlewareServer.servers() assert len(servers) > 0, "There is no server(s) available in UI" for server in get_random_list(servers, ITEMS_LIMIT): ui_deps = _get_deployments_set( MiddlewareDeployment.deployments(server=server)) db_deps = _get_deployments_set( MiddlewareDeployment.deployments_in_db(server=server)) assert ui_deps == db_deps, \ ("Lists of deployments mismatch! UI:{}, DB:{}".format(ui_deps, db_deps))
def check_deployment_appears(provider, server, runtime_name): provider.refresh_provider_relationships(method="ui") wait_for( lambda: runtime_name in get_deployments_statuses(MiddlewareDeployment.deployments(provider=provider, server=server)), delay=30, num_sec=1200, message="Deployment {} must be found for server {}".format(runtime_name, server.name), )
def test_list_provider_deployments(provider): """Tests deployments list from current Provider between UI, DB and Management system Steps: * Get deployments list from UI of provider * Get deployments list from Database of provider * Get deployments list from Management system(Hawkular) of provider * Verifies that UI list contains all DB entities * Verifies that UI list contains all MGMT entities """ ui_deps = get_deployments_set(MiddlewareDeployment.deployments(provider=provider)) db_deps = get_deployments_set(MiddlewareDeployment.deployments_in_db(provider=provider)) mgmt_deps = get_deployments_set(MiddlewareDeployment.deployments_in_mgmt(provider=provider)) assert ui_deps == db_deps, "Lists of deployments in UI does not contain the list in DB! UI:{}, DB:{}".format( ui_deps, db_deps ) assert ui_deps == mgmt_deps, "Lists of deployments in MGMT does not contain the list in DB! UI:{}, MGMT:{}".format( ui_deps, mgmt_deps )
def check_deployment_enabled(provider, server, runtime_name): check_deployment_appears(provider, server, runtime_name) provider.refresh_provider_relationships(method='ui') wait_for(lambda: get_deployments_statuses( MiddlewareDeployment.deployments(provider=provider, server=server))[runtime_name] == 'Enabled', delay=120, num_sec=1800, message='Deployment {} must be Enabled for server {}' .format(runtime_name, server.name))
def test_list_deployments(provider): """Tests deployments list between UI, DB and management system Steps: * Get deployments list from UI for whole Middleware * Get deployments list from Database for whole Middleware * Get deployments list from Management system for whole Middleware * Verifies that UI list contains all DB entities * Verifies that UI list contains all MGMT entities """ ui_deps = get_deployments_set(MiddlewareDeployment.deployments()) db_deps = get_deployments_set(MiddlewareDeployment.deployments_in_db()) mgmt_deps = get_deployments_set(MiddlewareDeployment.deployments_in_mgmt()) assert ui_deps == db_deps, \ ("Lists of deployments in UI does not contain the list in DB! UI:{}, DB:{}" .format(ui_deps, db_deps)) assert ui_deps == mgmt_deps, \ ("Lists of deployments in MGMT does not contain the list in DB! UI:{}, MGMT:{}" .format(ui_deps, mgmt_deps))
def check_deployment_disabled(provider, server, runtime_name): check_deployment_appears(provider, server, runtime_name) provider.refresh_provider_relationships(method='rest') wait_for(lambda: get_deployments_statuses( MiddlewareDeployment.deployments(provider=provider, server=server))[ runtime_name] == 'Disabled', delay=120, num_sec=1800, message='Deployment {} must be Disabled for server {}'.format( runtime_name, server.name))
def test_list_provider_server_deployments(provider): """Tests deployments list from current Provider for each server between UI, DB and Management system Steps: * Get Local server from UI of provider * Get deployments list for the server * Get deployments list from UI of provider, server * Get deployments list from Database of provider, server * Get deployments list from Database of provider, server * Get deployments list from Management system(Hawkular) of server * Compare size of all the list [UI, Database, Management system] """ server = get_server(provider, HAWKULAR_PRODUCT_NAME) ui_deps = get_deployments_set(MiddlewareDeployment.deployments(provider=provider, server=server)) db_deps = get_deployments_set(MiddlewareDeployment.deployments_in_db(provider=provider, server=server)) mgmt_deps = get_deployments_set(MiddlewareDeployment.deployments_in_mgmt(provider=provider, server=server)) assert ui_deps == db_deps == mgmt_deps, "Lists of deployments mismatch! UI:{}, DB:{}, MGMT:{}".format( ui_deps, db_deps, mgmt_deps )
def check_deployment_disabled(provider, server, runtime_name): check_deployment_appears(provider, server, runtime_name) refresh(provider) wait_for(lambda: get_deployments_statuses( MiddlewareDeployment.deployments(provider=provider, server=server))[runtime_name] == 'Disabled', delay=DELAY, num_sec=NUM_SECS, message='Deployment {} must be Disabled for server {}' .format(runtime_name, server.name), fail_func=lambda: refresh(provider))
def test_list_deployments(provider): """Tests deployments list between UI, DB and management system Steps: * Get deployments list from UI for whole Middleware * Get deployments list from Database for Hawkular Local server * Get deployments list from Management system for Hawkular Local server * Verifies that UI list contains all DB entities * Verifies that UI list contains all MGMT entities """ server = get_server(provider, HAWKULAR_PRODUCT_NAME) ui_deps = get_deployments_set(MiddlewareDeployment.deployments()) db_deps = get_deployments_set(MiddlewareDeployment.deployments_in_db(provider=provider, server=server)) mgmt_deps = get_deployments_set(MiddlewareDeployment.deployments_in_mgmt(provider=provider, server=server)) assert ui_deps >= db_deps, "Lists of deployments in UI does not contain the list in DB! UI:{}, DB:{}".format( ui_deps, db_deps ) assert ui_deps >= mgmt_deps, "Lists of deployments in MGMT does not contain the list in DB! UI:{}, MGMT:{}".format( ui_deps, mgmt_deps )
def test_deployment_tags(provider): """Tests tags in deployment page Steps: * Select a deployment randomly from database * Run `_validate_tags` with `tags` input """ deps_db = MiddlewareDeployment.deployments_in_db(provider=provider) assert len(deps_db) > 0, "There is no deployment(s) available in UI" deployment = get_random_list(deps_db, 1)[0] validate_tags(taggable=deployment, tags=tags)
def test_list_provider_deployments(provider): """Tests deployments list from current Provider between UI, DB and Management system Steps: * Get deployments list from UI of provider * Get deployments list from Database of provider * Get deployments list from Management system(Hawkular) of provider * Verifies that UI list contains all DB entities * Verifies that UI list contains all MGMT entities """ ui_deps = get_deployments_set(MiddlewareDeployment.deployments(provider=provider)) db_deps = get_deployments_set(MiddlewareDeployment.deployments_in_db( provider=provider)) mgmt_deps = get_deployments_set(MiddlewareDeployment.deployments_in_mgmt( provider=provider)) assert ui_deps == db_deps, \ ("Lists of deployments in UI does not contain the list in DB! UI:{}, DB:{}" .format(ui_deps, db_deps)) assert ui_deps == mgmt_deps, \ ("Lists of deployments in MGMT does not contain the list in DB! UI:{}, MGMT:{}" .format(ui_deps, mgmt_deps))
def test_deployment(provider): """Tests deployment details on UI Steps: * Get deployments list from UI * Select up to `ITEMS_LIMIT` deployments randomly * Compare selected deployment details with CFME database """ ui_deps = MiddlewareDeployment.deployments(provider=provider, server=get_server(provider, HAWKULAR_PRODUCT_NAME)) assert len(ui_deps) > 0, "There is no deployment(s) available in UI" for dep_ui in get_random_list(ui_deps, ITEMS_LIMIT): dep_db = dep_ui.deployment(method="db") assert dep_ui.name == dep_db.name, "deployment name does not match between UI and DB" assert dep_ui.server.name == dep_db.server.name, "deployment server name does not match between UI and DB" dep_ui.validate_properties()
def test_deployment(provider): """Tests deployment details on UI Steps: * Get deployments list from UI * Select up to `ITEMS_LIMIT` deployments randomly * Compare selected deployment details with CFME database """ ui_deps = MiddlewareDeployment.deployments(provider=provider) assert len(ui_deps) > 0, "There is no deployment(s) available in UI" for dep_ui in get_random_list(ui_deps, ITEMS_LIMIT): dep_db = dep_ui.deployment(method='db') assert dep_ui.name == dep_db.name, "deployment name does not match between UI and DB" assert dep_ui.server.name == dep_db.server.name, \ "deployment server name does not match between UI and DB" dep_ui.validate_properties()
def test_deployment_details(provider): """Tests deployment details on UI Steps: * Get deployments list from DB * Select up to `ITEMS_LIMIT` deployments randomly * Compare selected deployment details with CFME database and UI """ deps = MiddlewareDeployment.deployments_in_db(provider=provider, server=get_hawkular_server(provider)) assert len(deps) > 0, "There is no deployment(s) available in DB" for dep in get_random_list(deps, ITEMS_LIMIT): dep_ui = dep.deployment(method="ui") dep_db = dep.deployment(method="db") assert dep_ui, "deployment was not found in UI" assert dep_db, "deployment was not found in DB" assert dep_ui.name == dep_db.name, "deployment name does not match between UI:{}, DB:{}".format( dep_ui.name, dep_db.name ) dep_db.validate_properties()
def test_deployment_details(provider): """Tests deployment details on UI Steps: * Get deployments list from DB * Select up to `ITEMS_LIMIT` deployments randomly * Compare selected deployment details with CFME database and UI """ deps = MiddlewareDeployment.deployments_in_db(provider=provider, server=get_hawkular_server(provider)) assert len(deps) > 0, "There is no deployment(s) available in DB" for dep in get_random_list(deps, ITEMS_LIMIT): dep_ui = dep.deployment(method='ui') dep_db = dep.deployment(method='db') assert dep_ui, "deployment was not found in UI" assert dep_db, "deployment was not found in DB" assert dep_ui.name == dep_db.name, \ ("deployment name does not match between UI:{}, DB:{}" .format(dep_ui.name, dep_db.name)) dep_db.validate_properties()
def test_topology_server_hierarchy(provider): """Tests all server's hierarchical content in topology Steps: * Read Servers in topology. * For each server read elements in topology. * Compare elements from topology with server's elements from DB. """ # reload topology page to make sure all elements are loaded provider.topology.reload() provider.topology.refresh() for ui_server in provider.topology.elements(element_type='MiddlewareServer'): elements = [] server = MiddlewareServer.servers_in_db(name=ui_server.name)[0] elements.extend(MiddlewareDeployment.deployments_in_db(server, provider, strict=False)) elements.extend(MiddlewareDatasource.datasources_in_db(server, provider, strict=False)) elements.extend(MiddlewareMessaging.messagings_in_db(server, provider, strict=False)) verify_elements_included(elements, ui_server.children)
def get_random_deployment(provider): deployments = MiddlewareDeployment.deployments_in_db(provider=provider, strict=False) assert len(deployments) > 0, "There is no deployment(s) available in DB" return get_random_list(deployments, 1)[0]
def get_deployment_from_list(provider, server, runtime_name): for deployment in MiddlewareDeployment.deployments(provider=provider, server=server): if deployment.name == runtime_name: return deployment raise ValueError('Recently deployed archive {} was not found in deployments list' .format(runtime_name))
def get_random_deployment(provider): deployments = MiddlewareDeployment.deployments(provider=provider) assert len(deployments) > 0, "There is no deployment(s) available in UI" return get_random_list(deployments, 1)[0]