Class: Gitlab::QA::Component::SAML

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

Constant Summary collapse

DOCKER_IMAGE =
'jamedjo/test-saml-idp'.freeze
DOCKER_IMAGE_TAG =
'latest'.freeze

Instance Attribute Summary

Attributes inherited from Base

#docker, #environment, #network, #volumes

Instance Method Summary collapse

Methods inherited from Base

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

Methods included from Scenario::Actable

#act, included

Constructor Details

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

Instance Method Details

#group_nameObject



25
26
27
# File 'lib/gitlab/qa/component/saml.rb', line 25

def group_name
  @group_name ||= "saml_sso_group-#{SecureRandom.hex(4)}"
end

#instanceObject



29
30
31
32
33
# File 'lib/gitlab/qa/component/saml.rb', line 29

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

  super
end

#nameObject



21
22
23
# File 'lib/gitlab/qa/component/saml.rb', line 21

def name
  @name ||= "saml-qa-idp"
end

#set_assertion_consumer_service(assertion_con_service) ⇒ Object



17
18
19
# File 'lib/gitlab/qa/component/saml.rb', line 17

def set_assertion_consumer_service(assertion_con_service)
  @environment['SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE'] = assertion_con_service
end

#set_entity_id(entity_id) ⇒ Object



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

def set_entity_id(entity_id)
  @environment['SIMPLESAMLPHP_SP_ENTITY_ID'] = entity_id
end

#set_sandbox_name(sandbox_name) ⇒ Object

rubocop:enable Metrics/AbcSize



60
61
62
# File 'lib/gitlab/qa/component/saml.rb', line 60

def set_sandbox_name(sandbox_name)
  ::Gitlab::QA::Runtime::Env.gitlab_sandbox_name = sandbox_name
end

#set_simple_saml_hostnameObject



64
65
66
# File 'lib/gitlab/qa/component/saml.rb', line 64

def set_simple_saml_hostname
  ::Gitlab::QA::Runtime::Env.simple_saml_hostname = hostname
end

#startObject

rubocop:disable Metrics/AbcSize



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/gitlab/qa/component/saml.rb', line 36

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

    @volumes.to_h.each do |to, from|
      command.volume(to, from, 'Z')
    end

    @environment.to_h.each do |key, value|
      command.env(key, value)
    end

    @network_aliases.to_a.each do |network_alias|
      command << "--network-alias #{network_alias}"
    end
  end
end