Commit 31c0a3f3 authored by Mark Chao's avatar Mark Chao

Merge branch 'mk/enable-package-file-registries-field' into 'master'

Geo: Permanently enable package_file_registries field

Closes #255280

See merge request gitlab-org/gitlab!43245
parents 7f09a474 ff4dfc27
...@@ -6398,7 +6398,7 @@ type GeoNode { ...@@ -6398,7 +6398,7 @@ type GeoNode {
name: String name: String
""" """
Package file registries of the GeoNode. Available only when feature flag `geo_package_file_replication` is enabled Package file registries of the GeoNode
""" """
packageFileRegistries( packageFileRegistries(
""" """
......
...@@ -17863,7 +17863,7 @@ ...@@ -17863,7 +17863,7 @@
}, },
{ {
"name": "packageFileRegistries", "name": "packageFileRegistries",
"description": "Package file registries of the GeoNode. Available only when feature flag `geo_package_file_replication` is enabled", "description": "Package file registries of the GeoNode",
"args": [ "args": [
{ {
"name": "ids", "name": "ids",
...@@ -25,8 +25,7 @@ module Types ...@@ -25,8 +25,7 @@ module Types
field :package_file_registries, ::Types::Geo::PackageFileRegistryType.connection_type, field :package_file_registries, ::Types::Geo::PackageFileRegistryType.connection_type,
null: true, null: true,
resolver: ::Resolvers::Geo::PackageFileRegistriesResolver, resolver: ::Resolvers::Geo::PackageFileRegistriesResolver,
description: 'Package file registries of the GeoNode', description: 'Package file registries of the GeoNode'
feature_flag: :geo_package_file_replication
field :terraform_state_registries, ::Types::Geo::TerraformStateRegistryType.connection_type, field :terraform_state_registries, ::Types::Geo::TerraformStateRegistryType.connection_type,
null: true, null: true,
resolver: ::Resolvers::Geo::TerraformStateRegistriesResolver, resolver: ::Resolvers::Geo::TerraformStateRegistriesResolver,
......
---
title: 'Geo: Permanently enable package_file_registries field'
merge_request: 43245
author:
type: fixed
...@@ -4,6 +4,4 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37112 ...@@ -4,6 +4,4 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37112
rollout_issue_url: rollout_issue_url:
group: geo group: geo
type: development type: development
# it appears that in some places default_enabled: true
# `false` is specified vs `true` in other
default_enabled: [false, true]
...@@ -5,7 +5,8 @@ RSpec.shared_examples 'gets registries for' do |args| ...@@ -5,7 +5,8 @@ RSpec.shared_examples 'gets registries for' do |args|
let(:registry_class_name) { args[:registry_class_name] } let(:registry_class_name) { args[:registry_class_name] }
let(:registry_factory) { args[:registry_factory] } let(:registry_factory) { args[:registry_factory] }
let(:registry_foreign_key_field_name) { args[:registry_foreign_key_field_name] } let(:registry_foreign_key_field_name) { args[:registry_foreign_key_field_name] }
let(:feature_flag) { Geo.const_get(registry_class_name, false).replicator_class.replication_enabled_feature_key } let(:replicator_class) { Geo.const_get(registry_class_name, false).replicator_class }
let(:feature_flag) { replicator_class.replication_enabled_feature_key }
let(:registry_foreign_key) { registry_foreign_key_field_name.underscore } let(:registry_foreign_key) { registry_foreign_key_field_name.underscore }
let(:field_name_sym) { field_name.underscore.to_sym } let(:field_name_sym) { field_name.underscore.to_sym }
...@@ -108,17 +109,45 @@ RSpec.shared_examples 'gets registries for' do |args| ...@@ -108,17 +109,45 @@ RSpec.shared_examples 'gets registries for' do |args|
end end
end end
context 'when the geo_self_service_framework feature is disabled' do context 'when the feature is enabled by default' do
before do
skip "Skipping since #{replicator_class.name} is disabled by default" unless replicator_class.replication_enabled_by_default?
end
context 'when the feature is disabled' do
before do before do
stub_feature_flags(feature_flag => false) stub_feature_flags(feature_flag => false)
end end
# The purpose of this test is to catch if you forgot to remove the
# feature_flag option from the GraphQL field
it_behaves_like 'a working graphql query' do
before do
post_graphql(query, current_user: current_user)
end
end
end
end
context 'when the feature is disabled by default' do
before do
skip "Skipping since #{replicator_class.name} is enabled by default" if replicator_class.replication_enabled_by_default?
end
context 'when the feature is disabled' do
before do
stub_feature_flags(feature_flag => false)
end
# This test will also catch if you forgot to add the feature_flag option
# on the GraphQL field
it 'errors when requesting registries' do it 'errors when requesting registries' do
post_graphql(query, current_user: current_user) post_graphql(query, current_user: current_user)
expect_graphql_errors_to_include(/Field '#{field_name}' doesn't exist on type 'GeoNode'/) expect_graphql_errors_to_include(/Field '#{field_name}' doesn't exist on type 'GeoNode'/)
end end
end end
end
def registry_to_graphql_data_hash(registry) def registry_to_graphql_data_hash(registry)
{ {
......
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