Commit 0eec82b1 authored by Mark Chao's avatar Mark Chao

Merge branch 'georgekoltsov/move-bulk-import-ee-files' into 'master'

Move BulkImports EE files to correct location

See merge request gitlab-org/gitlab!59161
parents 764bead2 e16e5741
......@@ -7,19 +7,19 @@ module EE
EE_CONFIG = {
iterations: {
pipeline: EE::BulkImports::Groups::Pipelines::IterationsPipeline,
pipeline: ::BulkImports::Groups::Pipelines::IterationsPipeline,
stage: 1
},
epics: {
pipeline: EE::BulkImports::Groups::Pipelines::EpicsPipeline,
pipeline: ::BulkImports::Groups::Pipelines::EpicsPipeline,
stage: 2
},
epic_award_emojis: {
pipeline: EE::BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline,
pipeline: ::BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline,
stage: 3
},
epic_events: {
pipeline: EE::BulkImports::Groups::Pipelines::EpicEventsPipeline,
pipeline: ::BulkImports::Groups::Pipelines::EpicEventsPipeline,
stage: 3
},
# Override the CE stage value for the EntityFinisher Pipeline
......
# frozen_string_literal: true
module BulkImports
module Groups
module Graphql
module GetEpicAwardEmojiQuery
extend self
def to_s
<<-'GRAPHQL'
query($full_path: ID!, $epic_iid: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
epic(iid: $epic_iid) {
award_emoji: awardEmoji(first: $per_page, after: $cursor) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
}
nodes {
name
user {
public_email: publicEmail
}
}
}
}
}
}
GRAPHQL
end
def variables(context)
iid = context.extra[:epic_iid]
{
full_path: context.entity.source_full_path,
cursor: context.tracker.next_page,
epic_iid: iid,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
def data_path
base_path << 'nodes'
end
def page_info_path
base_path << 'page_info'
end
private
def base_path
%w[data group epic award_emoji]
end
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Groups
module Graphql
module GetEpicEventsQuery
extend self
def to_s
<<-'GRAPHQL'
query($full_path: ID!, $epic_iid: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
epic(iid: $epic_iid) {
events(first: $per_page, after: $cursor) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
}
nodes {
action
created_at: createdAt
updated_at: updatedAt
author {
public_email: publicEmail
}
}
}
}
}
}
GRAPHQL
end
def variables(context)
iid = context.extra[:epic_iid]
{
full_path: context.entity.source_full_path,
cursor: context.tracker.next_page,
epic_iid: iid,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
def data_path
base_path << 'nodes'
end
def page_info_path
base_path << 'page_info'
end
private
def base_path
%w[data group epic events]
end
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Groups
module Graphql
module GetEpicsQuery
extend self
def to_s
<<-'GRAPHQL'
query($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
epics(
includeDescendantGroups: false,
first: $per_page,
after: $cursor
) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
}
nodes {
id
iid
title
description
state
created_at: createdAt
closed_at: closedAt
start_date: startDate
start_date_fixed: startDateFixed
start_date_is_fixed: startDateIsFixed
due_date_fixed: dueDateFixed
due_date_is_fixed: dueDateIsFixed
relative_position: relativePosition
confidential
author {
public_email: publicEmail
}
parent {
iid
}
children {
nodes {
iid
}
}
labels {
nodes {
title
}
}
}
}
}
}
GRAPHQL
end
def variables(context)
{
full_path: context.entity.source_full_path,
cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
def base_path
%w[data group epics]
end
def data_path
base_path << 'nodes'
end
def page_info_path
base_path << 'page_info'
end
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Groups
module Graphql
module GetIterationsQuery
extend self
def to_s
<<-'GRAPHQL'
query($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
iterations(first: $per_page, after: $cursor, includeAncestors: false) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
}
nodes {
iid
title
description
state
start_date: startDate
due_date: dueDate
created_at: createdAt
updated_at: updatedAt
}
}
}
}
GRAPHQL
end
def variables(context)
{
full_path: context.entity.source_full_path,
cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
def base_path
%w[data group iterations]
end
def data_path
base_path << 'nodes'
end
def page_info_path
base_path << 'page_info'
end
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Groups
module Pipelines
class EpicAwardEmojiPipeline < ::BulkImports::Pipeline::EpicBase
extractor ::BulkImports::Common::Extractors::GraphqlExtractor,
query: ::BulkImports::Groups::Graphql::GetEpicAwardEmojiQuery
transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer
transformer ::BulkImports::Common::Transformers::UserReferenceTransformer
# rubocop: disable CodeReuse/ActiveRecord
def load(context, data)
return unless data
epic = context.group.epics.find_by(iid: context.extra[:epic_iid])
return if award_emoji_exists?(epic, data)
raise NotAllowedError unless Ability.allowed?(context.current_user, :award_emoji, epic)
epic.award_emoji.create!(data)
end
private
def award_emoji_exists?(epic, data)
epic.award_emoji.exists?(user_id: data['user_id'], name: data['name'])
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Groups
module Pipelines
class EpicEventsPipeline < ::BulkImports::Pipeline::EpicBase
extractor ::BulkImports::Common::Extractors::GraphqlExtractor,
query: ::BulkImports::Groups::Graphql::GetEpicEventsQuery
transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer
transformer ::BulkImports::Common::Transformers::UserReferenceTransformer, reference: 'author'
def transform(context, data)
# Only create 'reopened' & 'closed' events.
# 'created' event get created when epic is persisted.
# Avoid creating duplicates & protect from additional
# potential undesired events.
return unless data['action'] == 'REOPENED' || data['action'] == 'CLOSED'
data.merge!(
'group_id' => context.group.id,
'action' => data['action'].downcase
)
end
def load(context, data)
return unless data
epic = context.group.epics.find_by_iid(context.extra[:epic_iid])
return unless epic
::Event.transaction do
create_event!(epic, data)
create_resource_state_event!(epic, data)
end
end
private
def create_event!(epic, data)
epic.events.create!(data)
end
# In order for events to be shown in the UI we need to create
# `ResourceStateEvent` record
def create_resource_state_event!(epic, data)
state_event_data = {
user_id: data['author_id'],
state: data['action'],
created_at: data['created_at']
}
epic.resource_state_events.create!(state_event_data)
end
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Groups
module Pipelines
class EpicsPipeline
include ::BulkImports::Pipeline
extractor ::BulkImports::Common::Extractors::GraphqlExtractor,
query: ::BulkImports::Groups::Graphql::GetEpicsQuery
transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer
transformer ::BulkImports::Common::Transformers::UserReferenceTransformer, reference: 'author'
transformer ::BulkImports::Groups::Transformers::EpicAttributesTransformer
def transform(_, data)
cache_epic_source_params(data)
end
def load(context, data)
raise ::BulkImports::Pipeline::NotAllowedError unless authorized?
context.group.epics.create!(data)
end
private
def authorized?
context.current_user.can?(:admin_epic, context.group)
end
def cache_epic_source_params(data)
source_id = GlobalID.parse(data['id'])&.model_id
source_iid = data['iid']
if source_id
cache_key = "bulk_import:#{context.bulk_import.id}:entity:#{context.entity.id}:epic:#{source_iid}"
source_params = { source_id: source_id }
::Gitlab::Redis::Cache.with do |redis|
redis.set(cache_key, source_params.to_json, ex: ::BulkImports::Pipeline::CACHE_KEY_EXPIRATION)
end
end
data
end
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Groups
module Pipelines
class IterationsPipeline
include ::BulkImports::Pipeline
extractor ::BulkImports::Common::Extractors::GraphqlExtractor,
query: ::BulkImports::Groups::Graphql::GetIterationsQuery
transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer
def load(context, data)
return unless data
raise ::BulkImports::Pipeline::NotAllowedError unless authorized?
context.group.iterations.create!(data)
end
private
def authorized?
context.current_user.can?(:admin_iteration, context.group)
end
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Groups
module Transformers
class EpicAttributesTransformer
def transform(context, data)
data
.then { |data| add_parent(context, data) }
.then { |data| add_children(context, data) }
.then { |data| add_labels(context, data) }
end
private
def add_parent(context, data)
data.merge(
'parent' => context.group.epics.find_by_iid(data.dig('parent', 'iid'))
)
end
def add_children(context, data)
nodes = Array.wrap(data.dig('children', 'nodes'))
children_iids = nodes.filter_map { |child| child['iid'] }
data.merge('children' => context.group.epics.where(iid: children_iids)) # rubocop: disable CodeReuse/ActiveRecord
end
def add_labels(context, data)
data['labels'] = data.dig('labels', 'nodes').filter_map do |node|
context.group.labels.find_by_title(node['title'])
end
data
end
end
end
end
end
# frozen_string_literal: true
module BulkImports
module Pipeline
class EpicBase
include ::BulkImports::Pipeline
def initialize(context)
super(context)
return if context.group.blank?
@epic_iids = context.group.epics.order(iid: :desc).pluck(:iid) # rubocop: disable CodeReuse/ActiveRecord
set_next_epic
end
def run
return skip!(skip_reason) if current_epic_iid.blank?
super
end
private
attr_reader :epic_iids
def after_run(extracted_data)
set_next_epic unless extracted_data.has_next_page?
if has_next_page_or_next_epic?(extracted_data)
run
end
end
def set_next_epic
context.extra[:epic_iid] = epic_iids.pop
end
def has_next_page_or_next_epic?(extracted_data)
extracted_data.has_next_page? || current_epic_iid
end
def current_epic_iid
context.extra[:epic_iid]
end
def skip_reason
if context.group.blank?
'Skipping because bulk import has no group'
else
'Skipping because group has no epics'
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Graphql
module GetEpicAwardEmojiQuery
extend self
def to_s
<<-'GRAPHQL'
query($full_path: ID!, $epic_iid: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
epic(iid: $epic_iid) {
award_emoji: awardEmoji(first: $per_page, after: $cursor) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
}
nodes {
name
user {
public_email: publicEmail
}
}
}
}
}
}
GRAPHQL
end
def variables(context)
iid = context.extra[:epic_iid]
{
full_path: context.entity.source_full_path,
cursor: context.tracker.next_page,
epic_iid: iid,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
def data_path
base_path << 'nodes'
end
def page_info_path
base_path << 'page_info'
end
private
def base_path
%w[data group epic award_emoji]
end
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Graphql
module GetEpicEventsQuery
extend self
def to_s
<<-'GRAPHQL'
query($full_path: ID!, $epic_iid: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
epic(iid: $epic_iid) {
events(first: $per_page, after: $cursor) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
}
nodes {
action
created_at: createdAt
updated_at: updatedAt
author {
public_email: publicEmail
}
}
}
}
}
}
GRAPHQL
end
def variables(context)
iid = context.extra[:epic_iid]
{
full_path: context.entity.source_full_path,
cursor: context.tracker.next_page,
epic_iid: iid,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
def data_path
base_path << 'nodes'
end
def page_info_path
base_path << 'page_info'
end
private
def base_path
%w[data group epic events]
end
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Graphql
module GetEpicsQuery
extend self
def to_s
<<-'GRAPHQL'
query($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
epics(
includeDescendantGroups: false,
first: $per_page,
after: $cursor
) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
}
nodes {
id
iid
title
description
state
created_at: createdAt
closed_at: closedAt
start_date: startDate
start_date_fixed: startDateFixed
start_date_is_fixed: startDateIsFixed
due_date_fixed: dueDateFixed
due_date_is_fixed: dueDateIsFixed
relative_position: relativePosition
confidential
author {
public_email: publicEmail
}
parent {
iid
}
children {
nodes {
iid
}
}
labels {
nodes {
title
}
}
}
}
}
}
GRAPHQL
end
def variables(context)
{
full_path: context.entity.source_full_path,
cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
def base_path
%w[data group epics]
end
def data_path
base_path << 'nodes'
end
def page_info_path
base_path << 'page_info'
end
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Graphql
module GetIterationsQuery
extend self
def to_s
<<-'GRAPHQL'
query($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
iterations(first: $per_page, after: $cursor, includeAncestors: false) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
}
nodes {
iid
title
description
state
start_date: startDate
due_date: dueDate
created_at: createdAt
updated_at: updatedAt
}
}
}
}
GRAPHQL
end
def variables(context)
{
full_path: context.entity.source_full_path,
cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
def base_path
%w[data group iterations]
end
def data_path
base_path << 'nodes'
end
def page_info_path
base_path << 'page_info'
end
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Pipelines
class EpicAwardEmojiPipeline < EE::BulkImports::Pipeline::EpicBase
extractor ::BulkImports::Common::Extractors::GraphqlExtractor,
query: EE::BulkImports::Groups::Graphql::GetEpicAwardEmojiQuery
transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer
transformer ::BulkImports::Common::Transformers::UserReferenceTransformer
# rubocop: disable CodeReuse/ActiveRecord
def load(context, data)
return unless data
epic = context.group.epics.find_by(iid: context.extra[:epic_iid])
return if award_emoji_exists?(epic, data)
raise NotAllowedError unless Ability.allowed?(context.current_user, :award_emoji, epic)
epic.award_emoji.create!(data)
end
private
def award_emoji_exists?(epic, data)
epic.award_emoji.exists?(user_id: data['user_id'], name: data['name'])
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Pipelines
class EpicEventsPipeline < EE::BulkImports::Pipeline::EpicBase
extractor ::BulkImports::Common::Extractors::GraphqlExtractor,
query: EE::BulkImports::Groups::Graphql::GetEpicEventsQuery
transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer
transformer ::BulkImports::Common::Transformers::UserReferenceTransformer, reference: 'author'
def transform(context, data)
# Only create 'reopened' & 'closed' events.
# 'created' event get created when epic is persisted.
# Avoid creating duplicates & protect from additional
# potential undesired events.
return unless data['action'] == 'REOPENED' || data['action'] == 'CLOSED'
data.merge!(
'group_id' => context.group.id,
'action' => data['action'].downcase
)
end
def load(context, data)
return unless data
epic = context.group.epics.find_by_iid(context.extra[:epic_iid])
return unless epic
::Event.transaction do
create_event!(epic, data)
create_resource_state_event!(epic, data)
end
end
private
def create_event!(epic, data)
epic.events.create!(data)
end
# In order for events to be shown in the UI we need to create
# `ResourceStateEvent` record
def create_resource_state_event!(epic, data)
state_event_data = {
user_id: data['author_id'],
state: data['action'],
created_at: data['created_at']
}
epic.resource_state_events.create!(state_event_data)
end
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Pipelines
class EpicsPipeline
include ::BulkImports::Pipeline
extractor ::BulkImports::Common::Extractors::GraphqlExtractor,
query: EE::BulkImports::Groups::Graphql::GetEpicsQuery
transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer
transformer ::BulkImports::Common::Transformers::UserReferenceTransformer, reference: 'author'
transformer EE::BulkImports::Groups::Transformers::EpicAttributesTransformer
def transform(_, data)
cache_epic_source_params(data)
end
def load(context, data)
raise ::BulkImports::Pipeline::NotAllowedError unless authorized?
context.group.epics.create!(data)
end
private
def authorized?
context.current_user.can?(:admin_epic, context.group)
end
def cache_epic_source_params(data)
source_id = GlobalID.parse(data['id'])&.model_id
source_iid = data['iid']
if source_id
cache_key = "bulk_import:#{context.bulk_import.id}:entity:#{context.entity.id}:epic:#{source_iid}"
source_params = { source_id: source_id }
::Gitlab::Redis::Cache.with do |redis|
redis.set(cache_key, source_params.to_json, ex: ::BulkImports::Pipeline::CACHE_KEY_EXPIRATION)
end
end
data
end
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Pipelines
class IterationsPipeline
include ::BulkImports::Pipeline
extractor ::BulkImports::Common::Extractors::GraphqlExtractor,
query: EE::BulkImports::Groups::Graphql::GetIterationsQuery
transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer
def load(context, data)
return unless data
raise ::BulkImports::Pipeline::NotAllowedError unless authorized?
context.group.iterations.create!(data)
end
private
def authorized?
context.current_user.can?(:admin_iteration, context.group)
end
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Groups
module Transformers
class EpicAttributesTransformer
def transform(context, data)
data
.then { |data| add_parent(context, data) }
.then { |data| add_children(context, data) }
.then { |data| add_labels(context, data) }
end
private
def add_parent(context, data)
data.merge(
'parent' => context.group.epics.find_by_iid(data.dig('parent', 'iid'))
)
end
def add_children(context, data)
nodes = Array.wrap(data.dig('children', 'nodes'))
children_iids = nodes.filter_map { |child| child['iid'] }
data.merge('children' => context.group.epics.where(iid: children_iids)) # rubocop: disable CodeReuse/ActiveRecord
end
def add_labels(context, data)
data['labels'] = data.dig('labels', 'nodes').filter_map do |node|
context.group.labels.find_by_title(node['title'])
end
data
end
end
end
end
end
end
# frozen_string_literal: true
module EE
module BulkImports
module Pipeline
class EpicBase
include ::BulkImports::Pipeline
def initialize(context)
super(context)
return if context.group.blank?
@epic_iids = context.group.epics.order(iid: :desc).pluck(:iid) # rubocop: disable CodeReuse/ActiveRecord
set_next_epic
end
def run
return skip!(skip_reason) if current_epic_iid.blank?
super
end
private
attr_reader :epic_iids
def after_run(extracted_data)
set_next_epic unless extracted_data.has_next_page?
if has_next_page_or_next_epic?(extracted_data)
run
end
end
def set_next_epic
context.extra[:epic_iid] = epic_iids.pop
end
def has_next_page_or_next_epic?(extracted_data)
extracted_data.has_next_page? || current_epic_iid
end
def current_epic_iid
context.extra[:epic_iid]
end
def skip_reason
if context.group.blank?
'Skipping because bulk import has no group'
else
'Skipping because group has no epics'
end
end
end
end
end
end
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Graphql::GetEpicAwardEmojiQuery do
RSpec.describe BulkImports::Groups::Graphql::GetEpicAwardEmojiQuery do
it 'has a valid query' do
context = BulkImports::Pipeline::Context.new(create(:bulk_import_tracker), epic_iid: 1)
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Graphql::GetEpicEventsQuery do
RSpec.describe BulkImports::Groups::Graphql::GetEpicEventsQuery do
it 'has a valid query' do
context = BulkImports::Pipeline::Context.new(create(:bulk_import_tracker), epic_iid: 1)
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Graphql::GetEpicsQuery do
RSpec.describe BulkImports::Groups::Graphql::GetEpicsQuery do
it 'has a valid query' do
context = BulkImports::Pipeline::Context.new(create(:bulk_import_tracker))
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Graphql::GetIterationsQuery do
RSpec.describe BulkImports::Groups::Graphql::GetIterationsQuery do
it 'has a valid query' do
tracker = create(:bulk_import_tracker)
context = BulkImports::Pipeline::Context.new(tracker)
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline do
RSpec.describe BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:epic) { create(:epic, group: group) }
......@@ -134,7 +134,7 @@ RSpec.describe EE::BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline do
.to eq(
klass: BulkImports::Common::Extractors::GraphqlExtractor,
options: {
query: EE::BulkImports::Groups::Graphql::GetEpicAwardEmojiQuery
query: BulkImports::Groups::Graphql::GetEpicAwardEmojiQuery
}
)
end
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Pipelines::EpicEventsPipeline do
RSpec.describe BulkImports::Groups::Pipelines::EpicEventsPipeline do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:epic) { create(:epic, group: group) }
......@@ -143,7 +143,7 @@ RSpec.describe EE::BulkImports::Groups::Pipelines::EpicEventsPipeline do
.to eq(
klass: BulkImports::Common::Extractors::GraphqlExtractor,
options: {
query: EE::BulkImports::Groups::Graphql::GetEpicEventsQuery
query: BulkImports::Groups::Graphql::GetEpicEventsQuery
}
)
end
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Pipelines::EpicsPipeline, :clean_gitlab_redis_cache do
RSpec.describe BulkImports::Groups::Pipelines::EpicsPipeline, :clean_gitlab_redis_cache do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:bulk_import) { create(:bulk_import, user: user) }
......@@ -116,7 +116,7 @@ RSpec.describe EE::BulkImports::Groups::Pipelines::EpicsPipeline, :clean_gitlab_
.to eq(
klass: BulkImports::Common::Extractors::GraphqlExtractor,
options: {
query: EE::BulkImports::Groups::Graphql::GetEpicsQuery
query: BulkImports::Groups::Graphql::GetEpicsQuery
}
)
end
......@@ -126,7 +126,7 @@ RSpec.describe EE::BulkImports::Groups::Pipelines::EpicsPipeline, :clean_gitlab_
.to contain_exactly(
{ klass: BulkImports::Common::Transformers::ProhibitedAttributesTransformer, options: nil },
{ klass: BulkImports::Common::Transformers::UserReferenceTransformer, options: { reference: 'author' } },
{ klass: EE::BulkImports::Groups::Transformers::EpicAttributesTransformer, options: nil }
{ klass: BulkImports::Groups::Transformers::EpicAttributesTransformer, options: nil }
)
end
end
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Pipelines::IterationsPipeline do
RSpec.describe BulkImports::Groups::Pipelines::IterationsPipeline do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:timestamp) { Time.new(2020, 01, 01).utc }
......@@ -84,7 +84,7 @@ RSpec.describe EE::BulkImports::Groups::Pipelines::IterationsPipeline do
.to eq(
klass: BulkImports::Common::Extractors::GraphqlExtractor,
options: {
query: EE::BulkImports::Groups::Graphql::GetIterationsQuery
query: BulkImports::Groups::Graphql::GetIterationsQuery
}
)
end
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Groups::Transformers::EpicAttributesTransformer do
RSpec.describe BulkImports::Groups::Transformers::EpicAttributesTransformer do
let_it_be(:importer_user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:bulk_import) { create(:bulk_import, user: importer_user) }
......
......@@ -2,9 +2,9 @@
require 'spec_helper'
RSpec.describe EE::BulkImports::Pipeline::EpicBase do
RSpec.describe BulkImports::Pipeline::EpicBase do
let(:pipeline_class) do
Class.new(EE::BulkImports::Pipeline::EpicBase) do
Class.new(BulkImports::Pipeline::EpicBase) do
def extract(_)
::BulkImports::Pipeline::ExtractedData.new
end
......
......@@ -11,10 +11,10 @@ RSpec.describe BulkImports::Stage do
[1, BulkImports::Groups::Pipelines::LabelsPipeline],
[1, BulkImports::Groups::Pipelines::MilestonesPipeline],
[1, BulkImports::Groups::Pipelines::BadgesPipeline],
[1, EE::BulkImports::Groups::Pipelines::IterationsPipeline],
[2, EE::BulkImports::Groups::Pipelines::EpicsPipeline],
[3, EE::BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline],
[3, EE::BulkImports::Groups::Pipelines::EpicEventsPipeline],
[1, BulkImports::Groups::Pipelines::IterationsPipeline],
[2, BulkImports::Groups::Pipelines::EpicsPipeline],
[3, BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline],
[3, BulkImports::Groups::Pipelines::EpicEventsPipeline],
[4, BulkImports::Groups::Pipelines::EntityFinisher]
]
end
......
......@@ -12,10 +12,10 @@ RSpec.describe BulkImports::Stage do
[1, BulkImports::Groups::Pipelines::LabelsPipeline],
[1, BulkImports::Groups::Pipelines::MilestonesPipeline],
[1, BulkImports::Groups::Pipelines::BadgesPipeline],
[1, 'EE::BulkImports::Groups::Pipelines::IterationsPipeline'.constantize],
[2, 'EE::BulkImports::Groups::Pipelines::EpicsPipeline'.constantize],
[3, 'EE::BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline'.constantize],
[3, 'EE::BulkImports::Groups::Pipelines::EpicEventsPipeline'.constantize],
[1, 'BulkImports::Groups::Pipelines::IterationsPipeline'.constantize],
[2, 'BulkImports::Groups::Pipelines::EpicsPipeline'.constantize],
[3, 'BulkImports::Groups::Pipelines::EpicAwardEmojiPipeline'.constantize],
[3, 'BulkImports::Groups::Pipelines::EpicEventsPipeline'.constantize],
[4, BulkImports::Groups::Pipelines::EntityFinisher]
]
else
......
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