예제 #1
0
def test_can_select_by_label(cl, client, has_conf):
    has_conf.return_value = False
    result = MagicMock()
    result.items = [MagicMock()]

    v1 = MagicMock()
    v1.list_namespaced_service.return_value = result
    client.CoreV1Api.return_value = v1

    label_selector = "app=my-super-app"
    service_is_initialized("mysvc", label_selector=label_selector)
    v1.list_namespaced_service.assert_called_with(
        "default", label_selector=label_selector
    )
예제 #2
0
def service_endpoint_is_initialized(name: str,
                                    ns: str = "default",
                                    label_selector: str = "name in ({name})",
                                    secrets: Secrets = None):
    """
    !!!DEPRECATED!!!
    """
    _log_deprecated("service_endpoint_is_initialized",
                    "service_is_initialized")
    return service_is_initialized(name, ns, label_selector, secrets)
예제 #3
0
def test_expecting_service_should_be_initialized(cl, client,
                                                 has_conf):
    has_conf.return_value = False
    service = MagicMock()
    result = MagicMock()
    result.items = [service]

    v1 = MagicMock()
    v1.list_namespaced_service.return_value = result
    client.CoreV1Api.return_value = v1

    assert service_is_initialized("mysvc") is True
예제 #4
0
def test_expecting_service_should_be_initialized(cl, client, has_conf):
    has_conf.return_value = False
    service = MagicMock()
    result = MagicMock()
    result.items = [service]

    v1 = MagicMock()
    v1.list_namespaced_service.return_value = result
    client.CoreV1Api.return_value = v1

    assert service_is_initialized("mysvc") is True
    v1.list_namespaced_service.assert_called_with(
        "default", field_selector="metadata.name=mysvc")