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'

Constants inherited from Base

Base::CERTIFICATES_PATH

Instance Attribute Summary

Attributes inherited from Base

#additional_hosts, #airgapped_network, #docker, #environment, #logger, #network, #network_aliases, #ports, #runner_network, #secrets, #volumes

Instance Method Summary collapse

Methods inherited from Base

#add_network_alias, #hostname, #image, #initialize, #ip_address, #prepare, #prepare_airgapped_network, #prepare_docker_container, #prepare_docker_image, #prepare_network, #prepare_runner_network, #process_exec_commands, #pull, #restart, #start_instance, #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



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

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

  super
end

#nameObject



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

def name
  @name ||= "mailhog"
end

#set_mailhog_hostnameObject



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

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

#startObject



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

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