예제 #1
0
def test_get_sas_component_resources_bad_params(
        report: ViyaDeploymentReport) -> None:
    """
    This test verifies that a None value is returned when a request is made for a SAS component that isn't defined
    or for a resource that is not defined for an existing component.

    :param report: The populated ViyaDeploymentReport returned by the report() fixture.
    """
    # make sure None is returned
    assert report.get_sas_component_resources(
        "sas-foo", KubernetesResource.Kinds.DEPLOYMENT) is None
    assert report.get_sas_component_resources(
        KubectlTest.Values.COMPONENT_SAS_ANNOTATIONS_NAME, "Foo") is None
예제 #2
0
def test_get_sas_component_resources(report: ViyaDeploymentReport) -> None:
    """
    This test verifies that the resources from the given SAS Component is correctly returned from a completed report.

    :param report: The populated ViyaDeploymentReport returned by the report() fixture.
    """
    # get component resource details
    component_resource_details: Dict = report.get_sas_component_resources(
        KubectlTest.Values.COMPONENT_SAS_ANNOTATIONS_NAME,
        KubernetesResource.Kinds.DEPLOYMENT)

    # check for expected attributes
    assert len(component_resource_details) == 1
    assert KubectlTest.Values.COMPONENT_SAS_ANNOTATIONS_NAME in component_resource_details
    assert component_resource_details[KubectlTest.Values.COMPONENT_SAS_ANNOTATIONS_NAME][
               ReportKeys.ResourceDetails.RESOURCE_DEFINITION][KubernetesResource.Keys.KIND] == \
        KubernetesResource.Kinds.DEPLOYMENT