Example #1
0
    def test_localstack(self):
        options = gnomock.Options()
        preset = gnomock.Localstack(services=['s3'], version="0.11.0")
        localstack_request = gnomock.LocalstackRequest(options=options, preset=preset)
        id = ""

        try:
            response = self.api.start_localstack(localstack_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #2
0
    def test_redis(self):
        options = gnomock.Options()
        preset = gnomock.Redis(version="5")
        redis_request = gnomock.RedisRequest(options=options, preset=preset)
        id = ""

        try:
            response = self.api.start_redis(redis_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #3
0
    def test_memcached(self):
        options = gnomock.Options()
        preset = gnomock.Memcached(version="1.6.6-alpine")
        memcached_request = gnomock.MemcachedRequest(options=options, preset=preset)
        id = ""

        try:
            response = self.api.start_memcached(memcached_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #4
0
    def test_kafka(self):
        options = gnomock.Options()
        preset = gnomock.Kafka(version="2.5.1-L0")
        kafka_request = gnomock.KafkaRequest(options=options, preset=preset)
        id = ""

        try:
            response = self.api.start_kafka(kafka_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #5
0
    def test_kubernetes(self):
        options = gnomock.Options()
        preset = gnomock.Kubernetes(version="latest")
        kubernetes_request = gnomock.KubernetesRequest(options=options,
                                                       preset=preset)
        id = ""

        try:
            response = self.api.start_kubernetes(kubernetes_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id != "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #6
0
    def test_mysql(self):
        options = gnomock.Options()
        file_name = os.path.abspath("./test/testdata/mysql/schema.sql")
        preset = gnomock.Mysql(queries_files=[file_name], version="8")
        mysql_request = gnomock.MysqlRequest(options=options, preset=preset)
        id = ""

        try:
            response = self.api.start_mysql(mysql_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #7
0
    def test_mongo(self):
        options = gnomock.Options()
        file_name = os.path.abspath("./test/testdata/mongo")
        preset = gnomock.Mongo(data_path=file_name, version="3")
        mongo_request = gnomock.MongoRequest(options=options, preset=preset)
        id = ""

        try:
            response = self.api.start_mongo(mongo_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #8
0
    def test_rabbitmq(self):
        options = gnomock.Options()
        preset = gnomock.Rabbitmq(version="3.8.5-alpine")
        rabbitmq_request = gnomock.RabbitmqRequest(options=options,
                                                   preset=preset)
        id = ""

        try:
            response = self.api.start_rabbit_mq(rabbitmq_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #9
0
    def test_elastic(self):
        options = gnomock.Options()
        preset = gnomock.Elastic(version="7.9.2")
        elastic_request = gnomock.ElasticRequest(options=options,
                                                 preset=preset)
        id = ""

        try:
            response = self.api.start_elastic(elastic_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #10
0
    def test_redis(self):
        options = gnomock.Options(debug=True)
        values = {"foo": "bar", "number": 42, "float": 3.14}
        preset = gnomock.Redis(version="5", values=values)
        redis_request = gnomock.RedisRequest(options=options, preset=preset)
        id = ""

        try:
            response = self.api.start_redis(redis_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id != "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #11
0
    def test_cockroachdb(self):
        options = gnomock.Options()
        preset = gnomock.Cockroachdb(version="latest")
        cockroachdb_request = gnomock.CockroachdbRequest(options=options,
                                                         preset=preset)
        id = ""

        try:
            response = self.api.start_cockroach_db(cockroachdb_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id != "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #12
0
    def test_cassandra(self):
        options = gnomock.Options(debug=True)
        preset = gnomock.Cassandra(version="3")
        cassandra_request = gnomock.CassandraRequest(options=options,
                                                     preset=preset)
        id = ""

        try:
            response = self.api.start_cassandra(cassandra_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id != "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #13
0
    def test_postgres(self):
        options = gnomock.Options()
        file_name = os.path.abspath("./test/testdata/postgres/schema.sql")
        preset = gnomock.Postgres(queries_files=[file_name], version="12")
        postgres_request = gnomock.PostgresRequest(options=options,
                                                   preset=preset)
        id = ""

        try:
            response = self.api.start_postgres(postgres_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id != "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #14
0
    def test_splunk(self):
        options = gnomock.Options()
        file_name = os.path.abspath("./test/testdata/splunk/events.jsonl")
        preset = gnomock.Splunk(values_file=file_name, accept_license=True,
                admin_password="******", version="8.0.2.1")
        splunk_request = gnomock.SplunkRequest(options=options, preset=preset)
        id = ""

        try:
            response = self.api.start_splunk(splunk_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id is not "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #15
0
    def test_influxdb(self):
        options = gnomock.Options()
        preset = gnomock.Influxdb(version="latest",
                                  username="******",
                                  password="******",
                                  org="python-org",
                                  bucket="python-bucket",
                                  auth_token="python-token")
        influxdb_request = gnomock.InfluxdbRequest(options=options,
                                                   preset=preset)
        id = ""

        try:
            response = self.api.start_influx_db(influxdb_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id != "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #16
0
    def test_rabbitmq(self):
        file_name = os.path.abspath("./test/testdata/rabbitmq/messages.jsonl")
        options = gnomock.Options()
        message = gnomock.RabbitmqMessage(queue="alerts",
                                          content_type="text/plain",
                                          string_body="python")
        preset = gnomock.Rabbitmq(version="3.8.5-alpine",
                                  messages_files=[file_name],
                                  messages=[message])
        rabbitmq_request = gnomock.RabbitmqRequest(options=options,
                                                   preset=preset)
        id = ""

        try:
            response = self.api.start_rabbit_mq(rabbitmq_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id != "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)
Example #17
0
    def test_memcached(self):
        options = gnomock.Options()
        values = {
            "foo": "bar",
        }
        byte_values = {"key": "Z25vbW9jawo="}
        preset = gnomock.Memcached(version="1.6.6-alpine",
                                   values=values,
                                   byte_values=byte_values)
        memcached_request = gnomock.MemcachedRequest(options=options,
                                                     preset=preset)
        id = ""

        try:
            response = self.api.start_memcached(memcached_request)
            id = response.id
            self.assertEqual("127.0.0.1", response.host)

        finally:
            if id != "":
                stop_request = gnomock.StopRequest(id=id)
                self.api.stop(stop_request)