Commit b6bdd773 authored by Avielle Wolfe's avatar Avielle Wolfe

Fix feature flag error

The `feature_flag:` key doesn't seem to work with our new YAML feature
flag flow. Therefore, we'll stop using it and make the field `nil` if
the feature flag is disabled
parent 2aa61151
...@@ -4651,7 +4651,7 @@ An edge in a connection. ...@@ -4651,7 +4651,7 @@ An edge in a connection.
| `alertManagementIntegrations` | [`AlertManagementIntegrationConnection`](#alertmanagementintegrationconnection) | Integrations which can receive alerts for the project. | | `alertManagementIntegrations` | [`AlertManagementIntegrationConnection`](#alertmanagementintegrationconnection) | Integrations which can receive alerts for the project. |
| `alertManagementPayloadFields` | [`[AlertManagementPayloadAlertField!]`](#alertmanagementpayloadalertfield) | Extract alert fields from payload for custom mapping. | | `alertManagementPayloadFields` | [`[AlertManagementPayloadAlertField!]`](#alertmanagementpayloadalertfield) | Extract alert fields from payload for custom mapping. |
| `allowMergeOnSkippedPipeline` | [`Boolean`](#boolean) | If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of the project can also be merged with skipped jobs. | | `allowMergeOnSkippedPipeline` | [`Boolean`](#boolean) | If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of the project can also be merged with skipped jobs. |
| `apiFuzzingCiConfiguration` | [`ApiFuzzingCiConfiguration`](#apifuzzingciconfiguration) | API fuzzing configuration for the project. Available only when feature flag `api_fuzzing_configuration_ui` is enabled. | | `apiFuzzingCiConfiguration` | [`ApiFuzzingCiConfiguration`](#apifuzzingciconfiguration) | API fuzzing configuration for the project. Null unless feature flag `api_fuzzing_configuration_ui` is enabled. |
| `archived` | [`Boolean`](#boolean) | Indicates the archived status of the project. | | `archived` | [`Boolean`](#boolean) | Indicates the archived status of the project. |
| `autocloseReferencedIssues` | [`Boolean`](#boolean) | Indicates if issues referenced by merge requests and commits within the default branch are closed automatically. | | `autocloseReferencedIssues` | [`Boolean`](#boolean) | Indicates if issues referenced by merge requests and commits within the default branch are closed automatically. |
| `avatarUrl` | [`String`](#string) | URL to avatar image file of the project. | | `avatarUrl` | [`String`](#string) | URL to avatar image file of the project. |
......
...@@ -129,8 +129,8 @@ module EE ...@@ -129,8 +129,8 @@ module EE
field :api_fuzzing_ci_configuration, field :api_fuzzing_ci_configuration,
::Types::AppSec::Fuzzing::Api::CiConfigurationType, ::Types::AppSec::Fuzzing::Api::CiConfigurationType,
null: true, null: true,
description: 'API fuzzing configuration for the project.', description: 'API fuzzing configuration for the project. '\
feature_flag: :api_fuzzing_configuration_ui 'Null unless feature flag `api_fuzzing_configuration_ui` is enabled.'
field :push_rules, field :push_rules,
::Types::PushRulesType, ::Types::PushRulesType,
...@@ -140,7 +140,8 @@ module EE ...@@ -140,7 +140,8 @@ module EE
end end
def api_fuzzing_ci_configuration def api_fuzzing_ci_configuration
return unless Ability.allowed?(current_user, :read_vulnerability, object) return unless ::Feature.enabled?(:api_fuzzing_configuration_ui, object, default_enabled: :yaml) && \
Ability.allowed?(current_user, :read_vulnerability, object)
configuration = ::AppSec::Fuzzing::Api::CiConfiguration.new(project: object) configuration = ::AppSec::Fuzzing::Api::CiConfiguration.new(project: object)
......
...@@ -74,7 +74,7 @@ RSpec.describe 'Query.project(fullPath).apiFuzzingCiConfiguration' do ...@@ -74,7 +74,7 @@ RSpec.describe 'Query.project(fullPath).apiFuzzingCiConfiguration' do
stub_licensed_features(security_dashboard: false) stub_licensed_features(security_dashboard: false)
end end
it 'returns null' do it 'returns nil' do
post_graphql(query, current_user: user) post_graphql(query, current_user: user)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
...@@ -90,13 +90,12 @@ RSpec.describe 'Query.project(fullPath).apiFuzzingCiConfiguration' do ...@@ -90,13 +90,12 @@ RSpec.describe 'Query.project(fullPath).apiFuzzingCiConfiguration' do
stub_feature_flags(api_fuzzing_configuration_ui: false) stub_feature_flags(api_fuzzing_configuration_ui: false)
end end
it 'errors' do it 'returns nil' do
post_graphql(query, current_user: user) post_graphql(query, current_user: user)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(graphql_errors.first['message']).to eq( fuzzing_config = graphql_data.dig('project', 'apiFuzzingCiConfiguration')
"Field 'apiFuzzingCiConfiguration' doesn't exist on type 'Project'" expect(fuzzing_config).to be_nil
)
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment