def test_virtual_service_subset_warning(kiali_client, openshift_client, browser): gateway = get_yaml(istio_objects_path.strpath, GATEWAY) gateway_dict = get_dict(istio_objects_path.strpath, GATEWAY) _istio_config_create(openshift_client, gateway_dict, gateway, 'Gateway', 'networking.istio.io/v1alpha3', namespace=BOOKINFO_1) virtual_service = get_yaml(istio_objects_path.strpath, VIRTUAL_SERVICE_SUBSET) virtual_service_dict = get_dict(istio_objects_path.strpath, VIRTUAL_SERVICE_SUBSET) _istio_config_create(openshift_client, virtual_service_dict, virtual_service, 'VirtualService', 'networking.istio.io/v1alpha3', namespace=BOOKINFO_1) _create_dest_rule_vs(openshift_client, DEST_RULE_VS_REVIEWS) _istio_config_details_test(kiali_client, openshift_client, browser, virtual_service_dict, virtual_service, namespace=BOOKINFO_1, kind='VirtualService', api_version='networking.istio.io/v1alpha3', error_messages=[KIA1105, KIA1105]) _delete_dest_rule_vs(openshift_client, DEST_RULE_VS_REVIEWS)
def test_destination_rule_broken(kiali_client, openshift_client, browser): destination_rule_broken = get_yaml(istio_objects_path.strpath, DEST_RULE_BROKEN) destination_rule_broken_dict = get_dict(istio_objects_path.strpath, DEST_RULE_BROKEN) _istio_config_test(kiali_client, openshift_client, browser, destination_rule_broken_dict, destination_rule_broken, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.DESTINATION_RULE.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.NOT_VALID.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': destination_rule_broken_dict.metadata.name }], namespace=BOOKINFO_2, kind='DestinationRule', api_version='networking.istio.io/v1alpha3', service_name=DETAILS, error_messages=[KIA0203, KIA0209], check_service_details=False)
def test_destination_rule_host_warning(kiali_client, openshift_client, browser): destination_rule_warning = get_yaml(istio_objects_path.strpath, DEST_RULE_HOST_WARNING) destination_rule_warning_dict = get_dict(istio_objects_path.strpath, DEST_RULE_HOST_WARNING) _istio_config_test(kiali_client, openshift_client, browser, destination_rule_warning_dict, destination_rule_warning, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.DESTINATION_RULE.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.WARNING.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': 'reviews-dr2-svc' }], namespace=BOOKINFO_1, kind='DestinationRule', api_version='networking.istio.io/v1alpha3', service_name=DETAILS, error_messages=[KIA0202], check_service_details=False)
def test_virtual_service_broken(kiali_client, openshift_client, browser): virtual_service_broken = get_yaml(istio_objects_path.strpath, VIRTUAL_SERVICE_BROKEN) virtual_service_broken_dict = get_dict(istio_objects_path.strpath, VIRTUAL_SERVICE_BROKEN) _create_dest_rule_vs(openshift_client, DEST_RULE_VS_REVIEWS, BOOKINFO_3) try: _istio_config_test( kiali_client, openshift_client, browser, virtual_service_broken_dict, virtual_service_broken, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.VIRTUAL_SERVICE.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.NOT_VALID.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': virtual_service_broken_dict.metadata.name }], namespace=BOOKINFO_3, kind='VirtualService', api_version='networking.istio.io/v1alpha3', service_name=REVIEWS, error_messages=[KIA1101, KIA1107], check_service_details=False) finally: _delete_dest_rule_vs(openshift_client, DEST_RULE_VS_REVIEWS)
def test_virtual_service(kiali_client, openshift_client, browser): gateway = get_yaml(istio_objects_path.strpath, GATEWAY_LINK) gateway_dict = get_dict(istio_objects_path.strpath, GATEWAY_LINK) _istio_config_create(openshift_client, gateway_dict, gateway, 'Gateway', 'networking.istio.io/v1alpha3', namespace=BOOKINFO_2) virtual_service = get_yaml(istio_objects_path.strpath, VIRTUAL_SERVICE) virtual_service_dict = get_dict(istio_objects_path.strpath, VIRTUAL_SERVICE) _create_dest_rule_vs(openshift_client, DEST_RULE_VS_REVIEWS) _istio_config_test(kiali_client, openshift_client, browser, virtual_service_dict, virtual_service, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.VIRTUAL_SERVICE.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.VALID.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': virtual_service_dict.metadata.name }], namespace=BOOKINFO_2, kind='VirtualService', api_version='networking.istio.io/v1alpha3', service_name=REVIEWS, check_service_details=False, delete_istio_config=False) _vs_gateway_link_test(kiali_client, openshift_client, browser, gateway_dict, kind='Gateway', vs_name=virtual_service_dict.metadata.name, namespace=BOOKINFO_2) _delete_dest_rule_vs(openshift_client, DEST_RULE_VS_REVIEWS) _delete_gateway_vs(openshift_client, GATEWAY_LINK)
def _create_dest_rule_vs(openshift_client, destination_rule_conf, namespace=BOOKINFO_1): destination_rule = get_yaml(istio_objects_path.strpath, destination_rule_conf) destination_rule_dict = get_dict(istio_objects_path.strpath, destination_rule_conf) _istio_config_create(openshift_client, destination_rule_dict, destination_rule, 'DestinationRule', 'networking.istio.io/v1alpha3', namespace)
def test_destination_rule_host_6(kiali_client, openshift_client, browser): destination_rule = get_yaml(dr_hosts_path.strpath, DEST_RULE_6) destination_rule_dict = get_dict(dr_hosts_path.strpath, DEST_RULE_6) _dr_host_link_test(kiali_client, openshift_client, browser, destination_rule_dict, destination_rule, kind='DestinationRule', api_version='networking.istio.io/v1alpha3', namespace=BOOKINFO_1, is_link_expected=False)
def test_virtual_service_svc_warning(kiali_client, openshift_client, browser): virtual_service = get_yaml(istio_objects_path.strpath, VIRTUAL_SERVICE_SVC) virtual_service_dict = get_dict(istio_objects_path.strpath, VIRTUAL_SERVICE_SVC) _istio_config_create(openshift_client, virtual_service_dict, virtual_service, 'VirtualService', 'networking.istio.io/v1alpha3', namespace=BOOKINFO_2) virtual_service2 = get_yaml(istio_objects_path.strpath, VIRTUAL_SERVICE_SVC2) virtual_service_dict2 = get_dict(istio_objects_path.strpath, VIRTUAL_SERVICE_SVC2) _istio_config_create(openshift_client, virtual_service_dict2, virtual_service2, 'VirtualService', 'networking.istio.io/v1alpha3', namespace=BOOKINFO_2) _create_dest_rule_vs(openshift_client, DEST_RULE_VS_REVIEWS) _istio_config_details_test(kiali_client, openshift_client, browser, virtual_service_dict, virtual_service, namespace=BOOKINFO_2, kind='VirtualService', api_version='networking.istio.io/v1alpha3', error_messages=[KIA1106]) _istio_config_details_test(kiali_client, openshift_client, browser, virtual_service_dict2, virtual_service2, namespace=BOOKINFO_2, kind='VirtualService', api_version='networking.istio.io/v1alpha3', error_messages=[KIA1106]) _delete_dest_rule_vs(openshift_client, DEST_RULE_VS_REVIEWS)
def test_virtual_service_broken_weight(kiali_client, openshift_client, browser): virtual_service_broken = get_yaml(istio_objects_path.strpath, VIRTUAL_SERVICE_BROKEN_WEIGHT) virtual_service_broken_dict = get_dict(istio_objects_path.strpath, VIRTUAL_SERVICE_BROKEN_WEIGHT) try: _istio_config_create(openshift_client, virtual_service_broken_dict, virtual_service_broken, namespace=BOOKINFO_1, kind='VirtualService', api_version='networking.istio.io/v1alpha3') assert False, "'Weight sum should be 100' "\ "error should be thrown, or Galley is not configured" except (ApiException, InternalServerError): pass
def test_service_entry(kiali_client, openshift_client, browser): yaml = get_yaml(istio_objects_path.strpath, SERVICE_ENTRY) _dict = get_dict(istio_objects_path.strpath, SERVICE_ENTRY) _istio_config_test(kiali_client, openshift_client, browser, _dict, yaml, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.SERVICE_ENTRY.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': _dict.metadata.name }], namespace=BOOKINFO_1, kind='ServiceEntry', api_version='networking.istio.io/v1alpha3', service_name=DETAILS, check_service_details=False)
def test_gateway(kiali_client, openshift_client, browser, pick_namespace): gateway = get_yaml(istio_objects_path.strpath, GATEWAY) gateway_dict = get_dict(istio_objects_path.strpath, GATEWAY) namespace = pick_namespace(BOOKINFO_2) _istio_config_test(kiali_client, openshift_client, browser, gateway_dict, gateway, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.GATEWAY.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': gateway_dict.metadata.name }], namespace=namespace, kind='Gateway', api_version='networking.istio.io/v1alpha3', service_name=REVIEWS, check_service_details=False)
def test_route_rule(kiali_client, openshift_client, browser): route_rule = get_yaml(istio_objects_path.strpath, ROUTE_RULE) route_rule_dict = get_dict(istio_objects_path.strpath, ROUTE_RULE) _istio_config_test(kiali_client, openshift_client, browser, route_rule_dict, route_rule, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.ROUTE_RULE.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.VALID.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': route_rule_dict.metadata.name }], kind='RouteRule', api_version='config.istio.io/v1alpha2')
def test_destination_rule(kiali_client, openshift_client, browser): destination_rule = get_yaml(istio_objects_path.strpath, DEST_RULE) destination_rule_dict = get_dict(istio_objects_path.strpath, DEST_RULE) _istio_config_test(kiali_client, openshift_client, browser, destination_rule_dict, destination_rule, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.DESTINATION_RULE.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.VALID.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': destination_rule_dict.metadata.name }], kind='DestinationRule', api_version='networking.istio.io/v1alpha3')
def test_virtual_service(kiali_client, openshift_client, browser): virtual_service = get_yaml(istio_objects_path.strpath, VIRTUAL_SERVICE) virtual_service_dict = get_dict(istio_objects_path.strpath, VIRTUAL_SERVICE) _istio_config_test(kiali_client, openshift_client, browser, virtual_service_dict, virtual_service, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.VIRTUAL_SERVICE.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.VALID.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': virtual_service_dict.metadata.name }], kind='VirtualService', api_version='networking.istio.io/v1alpha3')
def test_auth_policy(kiali_client, openshift_client, browser): yaml = get_yaml(istio_objects_path.strpath, AUTH_POLICY) _dict = get_dict(istio_objects_path.strpath, AUTH_POLICY) _istio_config_test( kiali_client, openshift_client, browser, _dict, yaml, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.AUTHORIZATION_POLICY.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': _dict.metadata.name }], namespace=BOOKINFO_2, kind='AuthorizationPolicy', api_version='security.istio.io/v1beta1', service_name=DETAILS, check_service_details=False, error_messages=[KIA0101, KIA0102, KIA0004, KIA0001])
def test_destination_policy(kiali_client, openshift_client, browser): destination_policy = get_yaml(istio_objects_path.strpath, DEST_POLICY) destination_policy_dict = get_dict(istio_objects_path.strpath, DEST_POLICY) _istio_config_test( kiali_client, openshift_client, browser, destination_policy_dict, destination_policy, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.DESTINATION_POLICY.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.VALID.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': destination_policy_dict.metadata.name }], kind='DestinationPolicy', api_version='config.istio.io/v1alpha2')
def test_virtual_service_broken_weight_text(kiali_client, openshift_client, browser): virtual_service_broken = get_yaml(istio_objects_path.strpath, VIRTUAL_SERVICE_BROKEN_WEIGHT_TEXT) virtual_service_broken_dict = get_dict(istio_objects_path.strpath, VIRTUAL_SERVICE_BROKEN_WEIGHT_TEXT) try: _create_dest_rule_vs(openshift_client, DEST_RULE_VS_RATINGS) _istio_config_test( kiali_client, openshift_client, browser, virtual_service_broken_dict, virtual_service_broken, [{ 'name': IstioConfigPageFilter.ISTIO_TYPE.text, 'value': IstioConfigObjectType.VIRTUAL_SERVICE.text }, { 'name': IstioConfigPageFilter.CONFIG.text, 'value': IstioConfigValidationType.NOT_VALID.text }, { 'name': IstioConfigPageFilter.ISTIO_NAME.text, 'value': virtual_service_broken_dict.metadata.name }], namespace=BOOKINFO_1, kind='VirtualService', api_version='networking.istio.io/v1alpha3', service_name=RATINGS, error_messages=[ 'Weight must be a number', 'Weight sum should be 100' ], check_service_details=False) _delete_dest_rule_vs(openshift_client, DEST_RULE_VS_RATINGS) except (ApiException, InternalServerError): pass
def _create_gateway_vs(openshift_client, gateway_conf, namespace=BOOKINFO_1): gateway = get_yaml(istio_objects_path.strpath, gateway_conf) gateway_dict = get_dict(istio_objects_path.strpath, gateway_conf) _istio_config_create(openshift_client, gateway_dict, gateway, 'Gateway', 'networking.istio.io/v1alpha3', namespace)