示例#1
0
def test_delete_service_from_container(
        client, zk, test_application_name, test_application_token,
        minimal_mode, key, value):
    cm = ContainerManagement(huskar_client, key)

    path = '/huskar/service/%s/beta/%s' % (test_application_name, key)
    zk.create(path, json.dumps(value), makepath=True)
    cm.register_to(test_application_name, 'beta')

    if minimal_mode:
        zk.ensure_path('/huskar/service/%s' % test_application_name)
        sleep(0.1)

    assert zk.exists(path)
    assert cm.lookup() == [(test_application_name, 'beta')]

    url = '/api/service/%s/%s' % (test_application_name, 'beta')
    headers = {'Authorization': test_application_token}
    r = client.delete(url, data={'key': key}, headers=headers)
    assert_response_ok(r)

    assert not zk.exists(path)
    assert cm.lookup() == []
示例#2
0
 def register_container(self):
     cm = ContainerManagement(huskar_client, self.key)
     cm.raise_for_unbound(self.application_name, self.cluster_name,
                          self.key)
     cm.register_to(self.application_name, self.cluster_name)