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'.freeze
DOCKER_IMAGE_TAG =
'v1.0.0'.freeze

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, #instance_no_teardown, #prepare, #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



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

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

  super
end

#nameObject



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

def name
  @name ||= "mailhog"
end

#set_mailhog_hostnameObject



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

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

#startObject



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

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