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'
DOCKER_IMAGE_TAG =
'latest'

Instance Attribute Summary

Attributes inherited from Base

#docker, #environment, #network, #ports, #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

#group_nameObject



27
28
29
# File 'lib/gitlab/qa/component/saml.rb', line 27

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

#instanceObject



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

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

  super
end

#nameObject



23
24
25
# File 'lib/gitlab/qa/component/saml.rb', line 23

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

#set_assertion_consumer_service(assertion_con_service) ⇒ Object



19
20
21
# File 'lib/gitlab/qa/component/saml.rb', line 19

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

#set_entity_id(entity_id) ⇒ Object



15
16
17
# File 'lib/gitlab/qa/component/saml.rb', line 15

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

#set_sandbox_name(sandbox_name) ⇒ Object

rubocop:enable Metrics/AbcSize



62
63
64
# File 'lib/gitlab/qa/component/saml.rb', line 62

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

#set_simple_saml_hostnameObject



66
67
68
# File 'lib/gitlab/qa/component/saml.rb', line 66

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

#startObject

rubocop:disable Metrics/AbcSize



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

def start
  docker.run(image: image, tag: 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