class Gitlab::QA::Component::Elasticsearch
def initialize
def initialize @docker = Docker::Engine.new @environment = {} end
def instance
def instance prepare start yield self ensure teardown end
def name
def name @name ||= "elastic68" end
def prepare
def prepare @docker.pull(ELASTIC_IMAGE, ELASTIC_IMAGE_TAG) return if @docker.network_exists?(network) @docker.network_create(network) end
def start
def start @docker.run(ELASTIC_IMAGE, ELASTIC_IMAGE_TAG) do |command| command << "-d" command << "--name #{name}" command << "--net #{network}" command << "--publish 9200:9200" command << "--publish 9300:9300" command.env("discovery.type", "single-node") end end
def teardown
def teardown @docker.stop(name) @docker.remove(name) end