Class: Gitlab::QA::Component::MailHog

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/qa/component/mail_hog.rb

Constant Summary collapse

DOCKER_IMAGE =
'mailhog/mailhog'
DOCKER_IMAGE_TAG =
'v1.0.0'

Instance Attribute Summary

Attributes inherited from Base

#docker, #environment, #network, #runner_network, #volumes

Instance Method Summary collapse

Methods inherited from Base

#add_network_alias, #hostname, #image, #initialize, #prepare, #prepare_docker_container, #prepare_docker_image, #prepare_network, #process_exec_commands, #pull, #restart, #tag, #teardown, #teardown!

Methods included from Scenario::Actable

#act, included

Constructor Details

This class inherits a constructor from Gitlab::QA::Component::Base

Instance Method Details

#instanceObject



16
17
18
19
20
# File 'lib/gitlab/qa/component/mail_hog.rb', line 16

def instance
  raise 'Please provide a block!' unless block_given?

  super
end

#nameObject



12
13
14
# File 'lib/gitlab/qa/component/mail_hog.rb', line 12

def name
  @name ||= "mailhog"
end

#set_mailhog_hostnameObject



33
34
35
# File 'lib/gitlab/qa/component/mail_hog.rb', line 33

def set_mailhog_hostname
  ::Gitlab::QA::Runtime::Env.mailhog_hostname = hostname
end

#startObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/gitlab/qa/component/mail_hog.rb', line 22

def start
  docker.run(image: image, tag: tag) do |command|
    command << '-d '
    command << "--name #{name}"
    command << "--net #{network}"
    command << "--hostname #{hostname}"
    command << "--publish 1025:1025"
    command << "--publish 8025:8025"
  end
end