class Gitlab::QA::Scenario::Test::Integration::LDAP

Constants

ADMIN_GROUP
ADMIN_PASSWORD
ADMIN_USER
BASE_DN
BIND_DN
GROUP_BASE
LDAP_PORT
LDAP_TLS_PORT

Attributes

gitlab_name[R]
ldap_name[R]
network[R]
orchestrate_ldap_server[R]
spec_suite[R]
tls[R]

Public Class Methods

new() click to toggle source
# File lib/gitlab/qa/scenario/test/integration/ldap.rb, line 20
def initialize
  @ldap_name = 'ldap-server'
  @network = 'test'
end

Public Instance Methods

configure_omnibus(gitlab) click to toggle source
# File lib/gitlab/qa/scenario/test/integration/ldap.rb, line 25
def configure_omnibus(gitlab)
  raise NotImplementedError
end
ldap_hostname() click to toggle source
# File lib/gitlab/qa/scenario/test/integration/ldap.rb, line 49
def ldap_hostname
  "#{ldap_name}.#{network}"
end
ldap_servers_omnibus_config() click to toggle source
# File lib/gitlab/qa/scenario/test/integration/ldap.rb, line 29
            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() { || ... } click to toggle source
# File lib/gitlab/qa/scenario/test/integration/ldap.rb, line 67
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) click to toggle source
# File lib/gitlab/qa/scenario/test/integration/ldap.rb, line 80
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) click to toggle source
# File lib/gitlab/qa/scenario/test/integration/ldap.rb, line 53
def run_specs(gitlab, volumes = {}, *rspec_args)
  gitlab.instance do
    puts "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