Class: Gitlab::QA::Scenario::Test::Integration::LDAP
- Inherits:
 - 
      Gitlab::QA::Scenario::Template
      
        
- Object
 - Gitlab::QA::Scenario::Template
 - Gitlab::QA::Scenario::Test::Integration::LDAP
 
 
- Defined in:
 - lib/gitlab/qa/scenario/test/integration/ldap.rb
 
Direct Known Subclasses
Constant Summary collapse
- LDAP_PORT =
 389- LDAP_TLS_PORT =
 636- BASE_DN =
 'dc=example,dc=org'- BIND_DN =
 'cn=admin,dc=example,dc=org'- GROUP_BASE =
 'ou=Global Groups,dc=example,dc=org'- ADMIN_GROUP =
 'AdminGroup'- ADMIN_USER =
 'admin'- ADMIN_PASSWORD =
 'admin'
Instance Attribute Summary collapse
- 
  
    
      #gitlab_name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute gitlab_name.
 - 
  
    
      #ldap_name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute ldap_name.
 - 
  
    
      #network  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute network.
 - 
  
    
      #orchestrate_ldap_server  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute orchestrate_ldap_server.
 - 
  
    
      #spec_suite  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute spec_suite.
 - 
  
    
      #tls  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute tls.
 
Instance Method Summary collapse
- #configure_omnibus(gitlab) ⇒ Object
 - 
  
    
      #initialize  ⇒ LDAP 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of LDAP.
 - #ldap_hostname ⇒ Object
 - #ldap_servers_omnibus_config ⇒ Object
 - #orchestrate_ldap ⇒ Object
 - #perform(release, *rspec_args) ⇒ Object
 - #run_specs(gitlab, volumes = {}, *rspec_args) ⇒ Object
 
Methods inherited from Gitlab::QA::Scenario::Template
Constructor Details
#initialize ⇒ LDAP
Returns a new instance of LDAP.
      22 23 24 25  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 22 def initialize @ldap_name = 'ldap-server' @network = 'test' end  | 
  
Instance Attribute Details
#gitlab_name ⇒ Object (readonly)
Returns the value of attribute gitlab_name.
      20 21 22  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 20 def gitlab_name @gitlab_name end  | 
  
#ldap_name ⇒ Object (readonly)
Returns the value of attribute ldap_name.
      20 21 22  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 20 def ldap_name @ldap_name end  | 
  
#network ⇒ Object (readonly)
Returns the value of attribute network.
      20 21 22  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 20 def network @network end  | 
  
#orchestrate_ldap_server ⇒ Object (readonly)
Returns the value of attribute orchestrate_ldap_server.
      20 21 22  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 20 def orchestrate_ldap_server @orchestrate_ldap_server end  | 
  
#spec_suite ⇒ Object (readonly)
Returns the value of attribute spec_suite.
      20 21 22  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 20 def spec_suite @spec_suite end  | 
  
#tls ⇒ Object (readonly)
Returns the value of attribute tls.
      20 21 22  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 20 def tls @tls end  | 
  
Instance Method Details
#configure_omnibus(gitlab) ⇒ Object
      27 28 29  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 27 def configure_omnibus(gitlab) raise NotImplementedError end  | 
  
#ldap_hostname ⇒ Object
      51 52 53  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 51 def ldap_hostname "#{ldap_name}.#{network}" end  | 
  
#ldap_servers_omnibus_config ⇒ Object
      31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 31 def ldap_servers_omnibus_config YAML.safe_load <<~CFG main: label: LDAP host: #{ldap_hostname} port: #{tls ? LDAP_TLS_PORT : LDAP_PORT} uid: 'uid' bind_dn: #{BIND_DN} password: #{ADMIN_PASSWORD} encryption: #{tls ? 'simple_tls' : 'plain'} verify_certificates: false base: #{BASE_DN} user_filter: '' group_base: #{GROUP_BASE} admin_group: #{ADMIN_GROUP} external_groups: '' sync_ssh_keys: false CFG end  | 
  
#orchestrate_ldap ⇒ Object
      69 70 71 72 73 74 75 76 77 78 79 80  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 69 def orchestrate_ldap Component::LDAP.perform do |ldap| ldap.name = 'ldap-server' ldap.network = 'test' ldap.set_gitlab_credentials ldap.tls = tls ldap.instance do yield end end end  | 
  
#perform(release, *rspec_args) ⇒ Object
      82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 82 def perform(release, *rspec_args) Component::Gitlab.perform do |gitlab| gitlab.release = release gitlab.name = gitlab_name gitlab.network = 'test' gitlab.tls = tls configure_omnibus(gitlab) if orchestrate_ldap_server orchestrate_ldap { run_specs(gitlab, {}, *rspec_args) } else volumes = { 'admin': File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'qa/fixtures/ldap/admin'), 'non_admin': File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'qa/fixtures/ldap/non_admin') } run_specs(gitlab, volumes, *rspec_args) end end end  | 
  
#run_specs(gitlab, volumes = {}, *rspec_args) ⇒ Object
      55 56 57 58 59 60 61 62 63 64 65 66 67  | 
    
      # File 'lib/gitlab/qa/scenario/test/integration/ldap.rb', line 55 def run_specs(gitlab, volumes = {}, *rspec_args) gitlab.instance do Runtime::Logger.info("Running #{spec_suite} specs!") Component::Specs.perform do |specs| specs.suite = spec_suite specs.release = gitlab.release specs.network = gitlab.network specs.args = [gitlab.address, *rspec_args] specs.volumes = volumes end end end  |