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
21
22
23
24
|
# 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
@dws_name = 'duo-workflow-service'
@dws_hostname = "#{@dws_name}.#{@network}"
@dws_port = Component::DuoWorkflowService::GRPC_PORT
@boot_duo_workflow_service = false
@use_cloud_license = true
@has_add_on = true
@assign_seats = true
end
|
Instance Method Details
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 26
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
with_duo_workflow_service(gitlab_hostname: gitlab.hostname) do
gitlab.instance do
set_up_gitlab_duo(gitlab) if @use_cloud_license
run_specs(gitlab, *rspec_args)
end
end
end
end
end
end
|
#run_specs(gitlab, *rspec_args) ⇒ Object
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 107
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
79
80
81
82
83
84
85
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 79
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_duo_workflow_service(dws, gitlab_hostname:) ⇒ Object
87
88
89
90
91
92
93
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 87
def set_up_duo_workflow_service(dws, gitlab_hostname:)
dws.name = @dws_name
dws.network = @network
dws.ports = [@dws_port]
dws.configure_environment(gitlab_hostname: gitlab_hostname)
end
|
#set_up_gitlab(gitlab, release) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 59
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'
if @boot_duo_workflow_service
gitlab.omnibus_gitlab_rails_env['GITLAB_DUO_WORKFLOW_SERVICE_URL'] = "#{@dws_hostname}:#{@dws_port}"
gitlab.omnibus_gitlab_rails_env['GITLAB_DUO_WORKFLOW_SECURE'] = 'false'
end
gitlab.set_ee_activation_code if @use_cloud_license
end
|
#set_up_gitlab_duo(gitlab) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 95
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
|
#with_duo_workflow_service(gitlab_hostname:, &block) ⇒ Object
Boots the agentic-mock Duo Workflow Service alongside the AI Gateway and runs the
given block inside it. When @boot_duo_workflow_service is false (the default for
AiGateway and the No*/NoLicense variants) it is a no-op passthrough, so only the
DuoAgentPlatform scenario has the extra gRPC container.
49
50
51
52
53
54
55
56
57
|
# File 'lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb', line 49
def with_duo_workflow_service(gitlab_hostname:, &block)
return yield unless @boot_duo_workflow_service
Component::DuoWorkflowService.perform do |dws|
set_up_duo_workflow_service(dws, gitlab_hostname: gitlab_hostname)
dws.instance(&block)
end
end
|