Ejemplo n.º 1
0
def test_kubernetes_metrics_get_cpu_used(
        kubernetes_metrics_obj: KubernetesMetrics) -> None:
    """
    This test verifies that KubernetesMetrics.get_cpu_used() returns the correct value for defined metrics.

    :param kubernetes_metrics_obj: The pre-loaded KubernetesMetrics fixture object for testing.
    """
    assert kubernetes_metrics_obj.get_cpu_used("node") == "3%"
    assert kubernetes_metrics_obj.get_cpu_used("pod") is None
Ejemplo n.º 2
0
def test_kubernetes_metrics_get_cpu_used_missing(
        kubernetes_metrics_obj: KubernetesMetrics) -> None:
    """
    This test verifies that KubernetesMetrics.get_cpu_used() returns None for undefined metrics.

    :param kubernetes_metrics_obj: The pre-loaded KubernetesMetrics fixture object for testing.
    """
    assert kubernetes_metrics_obj.get_cpu_used("foo") is None