예제 #1
0
    def test_create_calico_endpoint_fail(self, m_con_add, m_client, m_host, m_sys_exit):
        m_client.get_endpoint.return_value = "Endpoint Exists"

        id_, path_ = 'testcontainer', 'path/to/ns'

        calico_rkt._create_calico_endpoint(container_id=id_,
                                           netns_path=path_,
                                           interface=ARGS['interface'],
                                           subnet=ARGS['subnet'])

        m_client.get_endpoint.assert_called_once_with(hostname=m_host,
                                                      orchestrator_id=ORCHESTRATOR_ID,
                                                      workload_id=id_)
        m_sys_exit.assert_called_once_with(1)
예제 #2
0
    def test_create_calico_endpoint_fail(self, m_con_add, m_client, m_host,
                                         m_sys_exit):
        m_client.get_endpoint.return_value = "Endpoint Exists"

        id_, path_ = 'testcontainer', 'path/to/ns'

        calico_rkt._create_calico_endpoint(container_id=id_,
                                           netns_path=path_,
                                           interface=ARGS['interface'],
                                           subnet=ARGS['subnet'])

        m_client.get_endpoint.assert_called_once_with(
            hostname=m_host, orchestrator_id=ORCHESTRATOR_ID, workload_id=id_)
        m_sys_exit.assert_called_once_with(1)
예제 #3
0
    def test_create_calico_endpoint(self, m_con_add, m_client, m_host):
        m_client.get_endpoint.return_value = None
        m_client.get_endpoint.side_effect = KeyError()

        id_, path_ = 'testcontainer', 'path/to/ns'

        calico_rkt._create_calico_endpoint(container_id=id_,
                                           netns_path=path_,
                                           interface=ARGS['interface'],
                                           subnet=ARGS['subnet'])

        m_client.get_endpoint.assert_called_once_with(
            hostname=m_host, orchestrator_id=ORCHESTRATOR_ID, workload_id=id_)
        m_con_add.assert_called_once_with(hostname=m_host,
                                          orchestrator_id=ORCHESTRATOR_ID,
                                          container_id=id_,
                                          netns_path=path_,
                                          interface=ARGS['interface'],
                                          subnet=ARGS['subnet'])
예제 #4
0
    def test_create_calico_endpoint(self, m_con_add, m_client, m_host):
        m_client.get_endpoint.return_value = None
        m_client.get_endpoint.side_effect = KeyError()

        id_, path_ = 'testcontainer', 'path/to/ns'

        calico_rkt._create_calico_endpoint(container_id=id_,
                                           netns_path=path_,
                                           interface=ARGS['interface'],
                                           subnet=ARGS['subnet'])

        m_client.get_endpoint.assert_called_once_with(hostname=m_host,
                                                      orchestrator_id=ORCHESTRATOR_ID,
                                                      workload_id=id_)
        m_con_add.assert_called_once_with(hostname=m_host,
                                          orchestrator_id=ORCHESTRATOR_ID,
                                          container_id=id_,
                                          netns_path=path_,
                                          interface=ARGS['interface'],
                                          subnet=ARGS['subnet'])