Commit 8f0eabed authored by Alex Kalderimis's avatar Alex Kalderimis

Rename drone_ci_service to drone_ci_integration

Renames project association from drone_ci_service to
drone_ci_integration.
parent 14b0cb06
...@@ -43,7 +43,7 @@ class Integration < ApplicationRecord ...@@ -43,7 +43,7 @@ class Integration < ApplicationRecord
asana assembla asana assembla
bamboo bugzilla buildkite bamboo bugzilla buildkite
campfire confluence custom_issue_tracker campfire confluence custom_issue_tracker
datadog datadog discord drone_ci
].to_set.freeze ].to_set.freeze
serialize :properties, JSON # rubocop:disable Cop/ActiveRecordSerialize serialize :properties, JSON # rubocop:disable Cop/ActiveRecordSerialize
......
...@@ -156,8 +156,8 @@ class Project < ApplicationRecord ...@@ -156,8 +156,8 @@ class Project < ApplicationRecord
has_one :confluence_integration, class_name: 'Integrations::Confluence' has_one :confluence_integration, class_name: 'Integrations::Confluence'
has_one :custom_issue_tracker_integration, class_name: 'Integrations::CustomIssueTracker' has_one :custom_issue_tracker_integration, class_name: 'Integrations::CustomIssueTracker'
has_one :datadog_integration, class_name: 'Integrations::Datadog' has_one :datadog_integration, class_name: 'Integrations::Datadog'
has_one :discord_service, class_name: 'Integrations::Discord' has_one :discord_integration, class_name: 'Integrations::Discord'
has_one :drone_ci_service, class_name: 'Integrations::DroneCi' has_one :drone_ci_integration, class_name: 'Integrations::DroneCi'
has_one :emails_on_push_service, class_name: 'Integrations::EmailsOnPush' has_one :emails_on_push_service, class_name: 'Integrations::EmailsOnPush'
has_one :ewm_service, class_name: 'Integrations::Ewm' has_one :ewm_service, class_name: 'Integrations::Ewm'
has_one :external_wiki_service, class_name: 'Integrations::ExternalWiki' has_one :external_wiki_service, class_name: 'Integrations::ExternalWiki'
......
...@@ -5,13 +5,13 @@ require 'spec_helper' ...@@ -5,13 +5,13 @@ require 'spec_helper'
RSpec.describe Projects::ServiceHookLogsController do RSpec.describe Projects::ServiceHookLogsController do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:service) { create(:drone_ci_service, project: project) } let(:integration) { create(:drone_ci_integration, project: project) }
let(:log) { create(:web_hook_log, web_hook: service.service_hook) } let(:log) { create(:web_hook_log, web_hook: integration.service_hook) }
let(:log_params) do let(:log_params) do
{ {
namespace_id: project.namespace, namespace_id: project.namespace,
project_id: project, project_id: project,
service_id: service.to_param, service_id: integration.to_param,
id: log.id id: log.id
} }
end end
...@@ -35,7 +35,7 @@ RSpec.describe Projects::ServiceHookLogsController do ...@@ -35,7 +35,7 @@ RSpec.describe Projects::ServiceHookLogsController do
it 'executes the hook and redirects to the service form' do it 'executes the hook and redirects to the service form' do
expect_any_instance_of(ServiceHook).to receive(:execute) expect_any_instance_of(ServiceHook).to receive(:execute)
expect_any_instance_of(described_class).to receive(:set_hook_execution_notice) expect_any_instance_of(described_class).to receive(:set_hook_execution_notice)
expect(subject).to redirect_to(edit_project_service_path(project, service)) expect(subject).to redirect_to(edit_project_service_path(project, integration))
end end
end end
end end
...@@ -38,7 +38,7 @@ FactoryBot.define do ...@@ -38,7 +38,7 @@ FactoryBot.define do
end end
end end
factory :drone_ci_service, class: 'Integrations::DroneCi' do factory :drone_ci_integration, class: 'Integrations::DroneCi' do
project project
active { true } active { true }
drone_url { 'https://bamboo.example.com' } drone_url { 'https://bamboo.example.com' }
......
...@@ -9,7 +9,7 @@ RSpec.describe Types::Projects::ServiceType do ...@@ -9,7 +9,7 @@ RSpec.describe Types::Projects::ServiceType do
it 'resolves the corresponding type for objects' do it 'resolves the corresponding type for objects' do
expect(described_class.resolve_type(build(:jira_service), {})).to eq(Types::Projects::Services::JiraServiceType) expect(described_class.resolve_type(build(:jira_service), {})).to eq(Types::Projects::Services::JiraServiceType)
expect(described_class.resolve_type(build(:service), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:service), {})).to eq(Types::Projects::Services::BaseServiceType)
expect(described_class.resolve_type(build(:drone_ci_service), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:drone_ci_integration), {})).to eq(Types::Projects::Services::BaseServiceType)
expect(described_class.resolve_type(build(:custom_issue_tracker_integration), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:custom_issue_tracker_integration), {})).to eq(Types::Projects::Services::BaseServiceType)
end end
end end
......
...@@ -196,8 +196,8 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do ...@@ -196,8 +196,8 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
end end
it 'recognizes other ci services' do it 'recognizes other ci services' do
project.create_drone_ci_service(active: true) project.create_drone_ci_integration(active: true)
project.drone_ci_service.update(token: 'token') project.drone_ci_integration.update!(token: 'token')
expect(gl_auth.find_for_git_client('drone-ci-token', 'token', project: project, ip: 'ip')).to eq(Gitlab::Auth::Result.new(nil, project, :ci, described_class.build_authentication_abilities)) expect(gl_auth.find_for_git_client('drone-ci-token', 'token', project: project, ip: 'ip')).to eq(Gitlab::Auth::Result.new(nil, project, :ci, described_class.build_authentication_abilities))
end end
......
...@@ -364,8 +364,8 @@ project: ...@@ -364,8 +364,8 @@ project:
- campfire_integration - campfire_integration
- confluence_integration - confluence_integration
- datadog_integration - datadog_integration
- discord_service - discord_integration
- drone_ci_service - drone_ci_integration
- emails_on_push_service - emails_on_push_service
- pipelines_email_service - pipelines_email_service
- mattermost_slash_commands_service - mattermost_slash_commands_service
......
...@@ -31,7 +31,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do ...@@ -31,7 +31,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end end
end end
shared_context :drone_ci_service do shared_context :drone_ci_integration do
let(:drone) { described_class.new } let(:drone) { described_class.new }
let(:project) { create(:project, :repository, name: 'project') } let(:project) { create(:project, :repository, name: 'project') }
let(:path) { project.full_path } let(:path) { project.full_path }
...@@ -67,14 +67,14 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do ...@@ -67,14 +67,14 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end end
describe "service page/path methods" do describe "service page/path methods" do
include_context :drone_ci_service include_context :drone_ci_integration
it { expect(drone.build_page(sha, branch)).to eq(build_page) } it { expect(drone.build_page(sha, branch)).to eq(build_page) }
it { expect(drone.commit_status_path(sha, branch)).to eq(commit_status_path) } it { expect(drone.commit_status_path(sha, branch)).to eq(commit_status_path) }
end end
describe '#commit_status' do describe '#commit_status' do
include_context :drone_ci_service include_context :drone_ci_integration
it 'returns the contents of the reactive cache' do it 'returns the contents of the reactive cache' do
stub_reactive_cache(drone, { commit_status: 'foo' }, 'sha', 'ref') stub_reactive_cache(drone, { commit_status: 'foo' }, 'sha', 'ref')
...@@ -84,7 +84,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do ...@@ -84,7 +84,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end end
describe '#calculate_reactive_cache' do describe '#calculate_reactive_cache' do
include_context :drone_ci_service include_context :drone_ci_integration
describe '#commit_status' do describe '#commit_status' do
subject { drone.calculate_reactive_cache(sha, branch)[:commit_status] } subject { drone.calculate_reactive_cache(sha, branch)[:commit_status] }
...@@ -130,7 +130,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do ...@@ -130,7 +130,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end end
describe "execute" do describe "execute" do
include_context :drone_ci_service include_context :drone_ci_integration
let(:user) { create(:user, username: 'username') } let(:user) { create(:user, username: 'username') }
let(:push_sample_data) do let(:push_sample_data) do
......
...@@ -47,8 +47,8 @@ RSpec.describe Project, factory_default: :keep do ...@@ -47,8 +47,8 @@ RSpec.describe Project, factory_default: :keep do
it { is_expected.to have_many(:boards) } it { is_expected.to have_many(:boards) }
it { is_expected.to have_one(:campfire_integration) } it { is_expected.to have_one(:campfire_integration) }
it { is_expected.to have_one(:datadog_integration) } it { is_expected.to have_one(:datadog_integration) }
it { is_expected.to have_one(:discord_service) } it { is_expected.to have_one(:discord_integration) }
it { is_expected.to have_one(:drone_ci_service) } it { is_expected.to have_one(:drone_ci_integration) }
it { is_expected.to have_one(:emails_on_push_service) } it { is_expected.to have_one(:emails_on_push_service) }
it { is_expected.to have_one(:pipelines_email_service) } it { is_expected.to have_one(:pipelines_email_service) }
it { is_expected.to have_one(:irker_service) } it { is_expected.to have_one(:irker_service) }
......
...@@ -4,15 +4,15 @@ require 'spec_helper' ...@@ -4,15 +4,15 @@ require 'spec_helper'
RSpec.describe ServiceHookPresenter do RSpec.describe ServiceHookPresenter do
let(:web_hook_log) { create(:web_hook_log, web_hook: service_hook) } let(:web_hook_log) { create(:web_hook_log, web_hook: service_hook) }
let(:service_hook) { create(:service_hook, integration: service) } let(:service_hook) { create(:service_hook, integration: integration) }
let(:service) { create(:drone_ci_service, project: project) } let(:integration) { create(:drone_ci_integration, project: project) }
let(:project) { create(:project) } let(:project) { create(:project) }
describe '#logs_details_path' do describe '#logs_details_path' do
subject { service_hook.present.logs_details_path(web_hook_log) } subject { service_hook.present.logs_details_path(web_hook_log) }
let(:expected_path) do let(:expected_path) do
"/#{project.namespace.path}/#{project.name}/-/services/#{service.to_param}/hook_logs/#{web_hook_log.id}" "/#{project.namespace.path}/#{project.name}/-/services/#{integration.to_param}/hook_logs/#{web_hook_log.id}"
end end
it { is_expected.to eq(expected_path) } it { is_expected.to eq(expected_path) }
...@@ -22,7 +22,7 @@ RSpec.describe ServiceHookPresenter do ...@@ -22,7 +22,7 @@ RSpec.describe ServiceHookPresenter do
subject { service_hook.present.logs_retry_path(web_hook_log) } subject { service_hook.present.logs_retry_path(web_hook_log) }
let(:expected_path) do let(:expected_path) do
"/#{project.namespace.path}/#{project.name}/-/services/#{service.to_param}/hook_logs/#{web_hook_log.id}/retry" "/#{project.namespace.path}/#{project.name}/-/services/#{integration.to_param}/hook_logs/#{web_hook_log.id}/retry"
end end
it { is_expected.to eq(expected_path) } it { is_expected.to eq(expected_path) }
......
...@@ -18,10 +18,10 @@ RSpec.describe WebHookLogPresenter do ...@@ -18,10 +18,10 @@ RSpec.describe WebHookLogPresenter do
end end
context 'service hook' do context 'service hook' do
let(:web_hook) { create(:service_hook, integration: service) } let(:web_hook) { create(:service_hook, integration: integration) }
let(:service) { create(:drone_ci_service, project: project) } let(:integration) { create(:drone_ci_integration, project: project) }
it { is_expected.to eq(project_service_hook_log_path(project, service, web_hook_log)) } it { is_expected.to eq(project_service_hook_log_path(project, integration, web_hook_log)) }
end end
end end
...@@ -38,10 +38,10 @@ RSpec.describe WebHookLogPresenter do ...@@ -38,10 +38,10 @@ RSpec.describe WebHookLogPresenter do
end end
context 'service hook' do context 'service hook' do
let(:web_hook) { create(:service_hook, integration: service) } let(:web_hook) { create(:service_hook, integration: integration) }
let(:service) { create(:drone_ci_service, project: project) } let(:integration) { create(:drone_ci_integration, project: project) }
it { is_expected.to eq(retry_project_service_hook_log_path(project, service, web_hook_log)) } it { is_expected.to eq(retry_project_service_hook_log_path(project, integration, web_hook_log)) }
end end
end end
end end
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'projects/services/edit' do RSpec.describe 'projects/services/edit' do
let(:integration) { create(:drone_ci_service, project: project) } let(:integration) { create(:drone_ci_integration, project: project) }
let(:project) { create(:project) } let(:project) { create(:project) }
before do before do
......
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