Exemplo n.º 1
0
def service_post_data(**kw):
    service = utils.get_test_service(**kw)
    if 'manifest' not in service:
        service['manifest'] = '''{
            "metadata": {
                "name": "test",
                "labels": {
                    "key": "value"
                }
            },
            "spec": {
                "ports": [
                    {
                    "port": 88,
                    "targetPort": 6379,
                    "protocol": "TCP"
                    }
                ],
                "selector": {
                    "bar": "foo"
                }
            }
            }'''
    internal = service_controller.ServicePatchType.internal_attrs()
    return remove_internal(service, internal)
Exemplo n.º 2
0
 def setUp(self):
     super(RPCAPITestCase, self).setUp()
     self.fake_bay = dbutils.get_test_bay(driver='fake-driver')
     self.fake_container = dbutils.get_test_container(driver='fake-driver')
     self.fake_pod = dbutils.get_test_pod(driver='fake-driver')
     self.fake_rc = dbutils.get_test_rc(driver='fake-driver')
     self.fake_service = dbutils.get_test_service(driver='fake-driver')
Exemplo n.º 3
0
 def setUp(self):
     super(RPCAPITestCase, self).setUp()
     self.fake_bay = dbutils.get_test_bay(driver='fake-driver')
     self.fake_container = dbutils.get_test_container(driver='fake-driver')
     self.fake_rc = dbutils.get_test_rc(driver='fake-driver')
     self.fake_service = dbutils.get_test_service(driver='fake-driver')
     self.fake_x509keypair = dbutils.get_test_x509keypair(
         driver='fake-driver')
     self.fake_certificate = objects.Certificate.from_db_bay(self.fake_bay)
     self.fake_certificate.csr = 'fake-csr'
Exemplo n.º 4
0
 def setUp(self):
     super(RPCAPITestCase, self).setUp()
     self.fake_bay = dbutils.get_test_bay(driver='fake-driver')
     self.fake_container = dbutils.get_test_container(driver='fake-driver')
     self.fake_rc = dbutils.get_test_rc(driver='fake-driver')
     self.fake_service = dbutils.get_test_service(driver='fake-driver')
     self.fake_x509keypair = dbutils.get_test_x509keypair(
         driver='fake-driver')
     self.fake_certificate = objects.Certificate.from_db_bay(self.fake_bay)
     self.fake_certificate.csr = 'fake-csr'
Exemplo n.º 5
0
def get_test_service(context, **kw):
    """Return a Service object with appropriate attributes.

    NOTE: The object leaves the attributes marked as changed, such
    that a create() could be used to commit it to the DB.
    """
    db_service = db_utils.get_test_service(**kw)
    # Let DB generate ID if it isn't specified explicitly
    if 'id' not in kw:
        del db_service['id']
    service = objects.Service(context)
    for key in db_service:
        setattr(service, key, db_service[key])
    return service
Exemplo n.º 6
0
def service_post_data(**kw):
    service = utils.get_test_service(**kw)
    if 'manifest' not in service:
        service['manifest'] = '''{
            "id": "service_foo",
            "kind": "Service",
            "apiVersion": "v1beta1",
            "port": 88,
            "selector": {
                "bar": "foo"
            },
            "labels": {
                "bar": "foo"
            }
        }'''
    internal = service_controller.ServicePatchType.internal_attrs()
    return remove_internal(service, internal)
Exemplo n.º 7
0
 def setUp(self):
     super(TestServiceObject, self).setUp()
     self.fake_service = utils.get_test_service()
Exemplo n.º 8
0
 def setUp(self):
     super(TestServiceObject, self).setUp()
     self.fake_service = utils.get_test_service()