def test_kiali_reduced_cluster_permissins(kiali_client): assert command_exec().oc_delete_kiali_permissions_from_cluster() with timeout(seconds=30, error_message='Timed out waiting for denial of Graph access'): while True: access = None try: kiali_client.graph_namespace(namespace='bookinfo') except: # Will reach there if the graph is NOT accessable access = False if access == False: break time.sleep(1) assert command_exec().oc_add_kaili_permissions_to_cluster() with timeout(seconds=30, error_message='Timed out waiting for Graph access'): while True: access = True try: # Will reach there if the graph is NOT accessable kiali_client.graph_namespace(namespace='bookinfo') except: access = False if access: break time.sleep(1)
def change_configmap_with_new_value(element_name, list, new_value, current_configmap_file, new_configmap_file): assert command_exec().oc_get_kiali_configmap(file = current_configmap_file) create_new_configmap_file(element_name, list, new_value, current_configmap_file, new_configmap_file) create_configmap_and_wait_for_kiali(new_configmap_file) return True
def _test_kiali_reduced_cluster_permissions(kiali_client): bookinfo_namespace = conftest.get_bookinfo_namespace() try: assert command_exec().oc_remove_cluster_role_rom_user_kiali() with timeout( seconds=60, error_message='Timed out waiting for denial of Graph access'): while True: text = get_graph_json(kiali_client, bookinfo_namespace) if "is not accessible" in text: break time.sleep(1) finally: assert command_exec().oc_add_cluster_role_to_user_kiali() with timeout(seconds=60, error_message='Timed out waiting for Graph access'): while True: text = get_graph_json(kiali_client, bookinfo_namespace) if "is not accessible" not in text and bookinfo_namespace in text: break time.sleep(1)
def create_configmap_and_wait_for_kiali(configmap_file): assert command_exec().oc_delete_kiali_config_map() assert command_exec().oc_create_kiali_config_map(file=configmap_file) assert command_exec().oc_delete_kiali_pod() assert command_exec().oc_wait_for_kiali_state('Running')