Пример #1
0
    def instance(cls):
        if "ZOOKEEPER_URI" in os.environ:
            parse = urlparse(os.environ["ZOOKEEPER_URI"])
            (host, port) = (parse.hostname, parse.port)
            fixture = ExternalService(host, port)
        else:
            (host, port) = ("127.0.0.1", get_open_port())
            fixture = cls(host, port)

        fixture.open()
        return fixture
Пример #2
0
    def instance(cls):
        if "ZOOKEEPER_URI" in os.environ:
            parse = urlparse(os.environ["ZOOKEEPER_URI"])
            (host, port) = (parse.hostname, parse.port)
            fixture = ExternalService(host, port)
        else:
            (host, port) = ("127.0.0.1", get_open_port())
            fixture = cls(host, port)

        fixture.open()
        return fixture
Пример #3
0
 def instance(cls, broker_id, zk_host, zk_port, zk_chroot=None, replicas=1, partitions=2):
     if zk_chroot is None:
         zk_chroot = "kafka-python_" + str(uuid.uuid4()).replace("-", "_")
     if "KAFKA_URI" in os.environ:
         parse = urlparse(os.environ["KAFKA_URI"])
         (host, port) = (parse.hostname, parse.port)
         fixture = ExternalService(host, port)
     else:
         (host, port) = ("127.0.0.1", get_open_port())
         fixture = KafkaFixture(host, port, broker_id, zk_host, zk_port, zk_chroot, replicas, partitions)
         fixture.open()
     return fixture
Пример #4
0
 def instance(cls, broker_id, zk_host, zk_port, zk_chroot=None, replicas=1, partitions=2):
     if zk_chroot is None:
         zk_chroot = "kafka-python_" + str(uuid.uuid4()).replace("-", "_")
     if "KAFKA_URI" in os.environ:
         parse = urlparse(os.environ["KAFKA_URI"])
         (host, port) = (parse.hostname, parse.port)
         fixture = ExternalService(host, port)
     else:
         (host, port) = ("127.0.0.1", get_open_port())
         fixture = KafkaFixture(host, port, broker_id, zk_host, zk_port, zk_chroot, replicas, partitions)
         fixture.open()
     return fixture