Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
c47c724d
Unverified
Commit
c47c724d
authored
3 weeks ago
by
Julie Huang
Browse files
Options
Downloads
Patches
Plain Diff
Ensure empty strings are coerced to nil when saving ai_gateway_url
parent
b811a384
No related branches found
No related tags found
3 merge requests
!181325
Fix ambiguous `created_at` in project.rb
,
!181225
[FIX] Ensure blank strings are coerced to nil before saving ai_gateway_url
,
!180727
Resolve "Extend job archival mechanism to the whole pipeline"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ee/app/graphql/mutations/ai/duo_settings/update.rb
+1
-1
1 addition, 1 deletion
ee/app/graphql/mutations/ai/duo_settings/update.rb
ee/spec/requests/api/graphql/ai/duo_settings/update_spec.rb
+15
-0
15 additions, 0 deletions
ee/spec/requests/api/graphql/ai/duo_settings/update_spec.rb
with
16 additions
and
1 deletion
ee/app/graphql/mutations/ai/duo_settings/update.rb
+
1
−
1
View file @
c47c724d
...
...
@@ -18,7 +18,7 @@ class Update < BaseMutation
def
resolve
(
**
args
)
raise_resource_not_available_error!
unless
Ability
.
allowed?
(
current_user
,
:manage_self_hosted_models_settings
)
result
=
::
Ai
::
DuoSettings
::
UpdateService
.
new
(
ai_gateway_url:
args
[
:ai_gateway_url
]).
execute
result
=
::
Ai
::
DuoSettings
::
UpdateService
.
new
(
ai_gateway_url:
args
[
:ai_gateway_url
]
.
presence
).
execute
if
result
.
error?
{
...
...
This diff is collapsed.
Click to expand it.
ee/spec/requests/api/graphql/ai/duo_settings/update_spec.rb
+
15
−
0
View file @
c47c724d
...
...
@@ -63,6 +63,21 @@
expect
{
duo_settings
.
reload
}.
to
change
{
duo_settings
.
ai_gateway_url
}.
to
(
"http://new-ai-gateway-url"
)
end
context
'when ai_gateway_url arg is a blank string'
do
let
(
:mutation_params
)
{
{
ai_gateway_url:
""
}
}
it
'coerces it to nil'
do
# an empty string will cause the Duo healthcheck to error
request
result
=
json_response
[
'data'
][
'duoSettingsUpdate'
]
expect
(
result
).
to
include
(
"aiGatewayUrl"
=>
nil
)
expect
(
result
[
'errors'
]).
to
eq
([])
expect
{
duo_settings
.
reload
}.
to
change
{
duo_settings
.
ai_gateway_url
}.
to
(
nil
)
end
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment