Class: Gitlab::QA::Scenario::Test::Integration::AiGatewayBase
Constant Summary
collapse
- SETUP_SRC_PATH =
File.expand_path('../../../../../../support/setup', __dir__)
- SETUP_DEST_PATH =
'/tmp/setup-scripts'
Instance Method Summary
collapse
perform
Constructor Details
Returns a new instance of AiGatewayBase.
12
13
14
15
16
17
18
19
20
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 12
def initialize
@network = Runtime::Env.docker_network
@ai_gateway_name = 'ai-gateway'
@ai_gateway_hostname = "#{@ai_gateway_name}.#{@network}"
@ai_gateway_port = 5000
@use_cloud_license = true
@has_add_on = true
@assign_seats = true
end
|
Instance Method Details
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 22
def perform(release, *rspec_args)
Component::Gitlab.perform do |gitlab|
set_up_gitlab(gitlab, release)
Component::AiGateway.perform do |ai_gateway|
set_up_ai_gateway(ai_gateway, gitlab_hostname: gitlab.hostname)
ai_gateway.instance do
gitlab.instance do
set_up_gitlab_duo(gitlab) if @use_cloud_license
run_specs(gitlab, *rspec_args)
end
end
end
end
end
|
#run_specs(gitlab, *rspec_args) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 70
def run_specs(gitlab, *rspec_args)
Runtime::Logger.info('Running AI Gateway specs!')
rspec_args << "--" unless rspec_args.include?('--')
rspec_args << "--tag" << @tag
Component::Specs.perform do |specs|
specs.suite = 'Test::Instance::All'
specs.release = gitlab.release
specs.network = gitlab.network
specs.args = [gitlab.address, *rspec_args]
end
end
|
#set_up_ai_gateway(ai_gateway, gitlab_hostname:) ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 50
def set_up_ai_gateway(ai_gateway, gitlab_hostname:)
ai_gateway.name = @ai_gateway_name
ai_gateway.network = @network
ai_gateway.ports = [@ai_gateway_port]
ai_gateway.configure_environment(gitlab_hostname: gitlab_hostname)
end
|
#set_up_gitlab(gitlab, release) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 39
def set_up_gitlab(gitlab, release)
gitlab.release = QA::Release.new(release)
gitlab.name = 'gitlab'
gitlab.network = @network
gitlab.omnibus_gitlab_rails_env['AI_GATEWAY_URL'] = "http://#{@ai_gateway_hostname}:#{@ai_gateway_port}"
gitlab.omnibus_gitlab_rails_env['LLM_DEBUG'] = 'true'
gitlab.set_ee_activation_code if @use_cloud_license
end
|
#set_up_gitlab_duo(gitlab) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 58
def set_up_gitlab_duo(gitlab)
Runtime::Logger.info('Setting up Gitlab Duo on GitLab instance')
gitlab.docker.copy(gitlab.name, SETUP_SRC_PATH, SETUP_DEST_PATH)
gitlab.docker.exec(
gitlab.name,
"ASSIGN_SEATS=#{@assign_seats} HAS_ADD_ON=#{@has_add_on} gitlab-rails runner #{SETUP_DEST_PATH}/gitlab_duo_setup.rb",
mask_secrets: gitlab.secrets
)
end
|