Commit 8367e91f authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix tests

parent 9e5be685
......@@ -15,11 +15,11 @@ class AddCiPipelineSourcePipelineIndexes < ActiveRecord::Migration
end
def down
remove_concurrent_index :ci_sources_pipelines, :project_id
remove_concurrent_index :ci_sources_pipelines, :pipeline_id
remove_concurrent_index :ci_sources_pipelines, :project_id if index_exists? :ci_sources_pipelines, :project_id
remove_concurrent_index :ci_sources_pipelines, :pipeline_id if index_exists? :ci_sources_pipelines, :pipeline_id
remove_concurrent_index :ci_sources_pipelines, :source_project_id
remove_concurrent_index :ci_sources_pipelines, :source_job_id
remove_concurrent_index :ci_sources_pipelines, :source_pipeline_id
remove_concurrent_index :ci_sources_pipelines, :source_project_id if index_exists? :ci_sources_pipelines, :source_project_id
remove_concurrent_index :ci_sources_pipelines, :source_job_id if index_exists? :ci_sources_pipelines, :source_job_id
remove_concurrent_index :ci_sources_pipelines, :source_pipeline_id if index_exists? :ci_sources_pipelines, :source_pipeline_id
end
end
......@@ -15,11 +15,11 @@ class AddCiPipelineSourcePipelineForeignKey < ActiveRecord::Migration
end
def down
remove_foreign_key :ci_sources_pipelines, :projects, column: :project_id
remove_foreign_key :ci_sources_pipelines, :ci_pipelines, column: :pipeline_id
remove_foreign_key :ci_sources_pipelines, column: :project_id
remove_foreign_key :ci_sources_pipelines, column: :pipeline_id
remove_foreign_key :ci_sources_pipelines, :projects, column: :source_project_id
remove_foreign_key :ci_sources_pipelines, :ci_builds, column: :source_job_id
remove_foreign_key :ci_sources_pipelines, :ci_pipelines, column: :source_pipeline_id
remove_foreign_key :ci_sources_pipelines, column: :source_project_id
remove_foreign_key :ci_sources_pipelines, column: :source_job_id
remove_foreign_key :ci_sources_pipelines, column: :source_pipeline_id
end
end
......@@ -316,20 +316,6 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_index "ci_pipeline_schedules", ["next_run_at", "active"], name: "index_ci_pipeline_schedules_on_next_run_at_and_active", using: :btree
add_index "ci_pipeline_schedules", ["project_id"], name: "index_ci_pipeline_schedules_on_project_id", using: :btree
create_table "ci_sources_pipelines", force: :cascade do |t|
t.integer "project_id"
t.integer "pipeline_id"
t.integer "source_project_id"
t.integer "source_job_id"
t.integer "source_pipeline_id"
end
add_index "ci_sources_pipelines", ["pipeline_id"], name: "index_ci_pipeline_source_pipelines_on_pipeline_id", using: :btree
add_index "ci_sources_pipelines", ["project_id"], name: "index_ci_pipeline_source_pipelines_on_project_id", using: :btree
add_index "ci_sources_pipelines", ["source_job_id"], name: "index_ci_pipeline_source_pipelines_on_source_job_id", using: :btree
add_index "ci_sources_pipelines", ["source_pipeline_id"], name: "index_ci_pipeline_source_pipelines_on_source_pipeline_id", using: :btree
add_index "ci_sources_pipelines", ["source_project_id"], name: "index_ci_pipeline_source_pipelines_on_source_project_id", using: :btree
create_table "ci_pipelines", force: :cascade do |t|
t.string "ref"
t.string "sha"
......@@ -391,6 +377,20 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_index "ci_runners", ["locked"], name: "index_ci_runners_on_locked", using: :btree
add_index "ci_runners", ["token"], name: "index_ci_runners_on_token", using: :btree
create_table "ci_sources_pipelines", force: :cascade do |t|
t.integer "project_id"
t.integer "pipeline_id"
t.integer "source_project_id"
t.integer "source_job_id"
t.integer "source_pipeline_id"
end
add_index "ci_sources_pipelines", ["pipeline_id"], name: "index_ci_pipeline_source_pipelines_on_pipeline_id", using: :btree
add_index "ci_sources_pipelines", ["project_id"], name: "index_ci_pipeline_source_pipelines_on_project_id", using: :btree
add_index "ci_sources_pipelines", ["source_job_id"], name: "index_ci_pipeline_source_pipelines_on_source_job_id", using: :btree
add_index "ci_sources_pipelines", ["source_pipeline_id"], name: "index_ci_pipeline_source_pipelines_on_source_pipeline_id", using: :btree
add_index "ci_sources_pipelines", ["source_project_id"], name: "index_ci_pipeline_source_pipelines_on_source_project_id", using: :btree
create_table "ci_trigger_requests", force: :cascade do |t|
t.integer "trigger_id", null: false
t.text "variables"
......@@ -1695,13 +1695,13 @@ ActiveRecord::Schema.define(version: 20170602003304) do
add_foreign_key "ci_builds", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_a2141b1522", on_delete: :nullify
add_foreign_key "ci_pipeline_schedules", "projects", name: "fk_8ead60fcc4", on_delete: :cascade
add_foreign_key "ci_pipeline_schedules", "users", column: "owner_id", name: "fk_9ea99f58d2", on_delete: :nullify
add_foreign_key "ci_pipelines", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_3d34ab2e06", on_delete: :nullify
add_foreign_key "ci_pipelines", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_262d4c2d19", on_delete: :nullify
add_foreign_key "ci_sources_pipelines", "ci_builds", column: "source_job_id", name: "fk_3f0c88d7dc", on_delete: :cascade
add_foreign_key "ci_sources_pipelines", "ci_pipelines", column: "pipeline_id", name: "fk_b8c0fac459", on_delete: :cascade
add_foreign_key "ci_sources_pipelines", "ci_pipelines", column: "source_pipeline_id", name: "fk_3a3e3cb83a", on_delete: :cascade
add_foreign_key "ci_sources_pipelines", "projects", column: "source_project_id", name: "fk_8868d0f3e4", on_delete: :cascade
add_foreign_key "ci_sources_pipelines", "projects", name: "fk_83b4346e48", on_delete: :cascade
add_foreign_key "ci_pipelines", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_3d34ab2e06", on_delete: :nullify
add_foreign_key "ci_pipelines", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_262d4c2d19", on_delete: :nullify
add_foreign_key "ci_trigger_requests", "ci_triggers", column: "trigger_id", name: "fk_b8ec8b7245", on_delete: :cascade
add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade
add_foreign_key "ci_variables", "projects", name: "fk_ada5eb64b3", on_delete: :cascade
......
......@@ -22,7 +22,7 @@ describe Ci::Pipeline, models: true do
it { is_expected.to have_many(:auto_canceled_jobs) }
it { is_expected.to have_one(:source_pipeline) }
it { is_expected.to have_many(:sourced_pipelines) }
it { is_expected.to have_many(:triggered_by_pipeline) }
it { is_expected.to have_one(:triggered_by_pipeline) }
it { is_expected.to have_many(:triggered_pipelines) }
it { is_expected.to validate_presence_of(:sha) }
......
......@@ -113,7 +113,7 @@ describe PipelineSerializer do
it "verifies number of queries" do
recorded = ActiveRecord::QueryRecorder.new { subject }
expect(recorded.count).to be_within(1).of(62)
expect(recorded.count).to be_within(1).of(64)
expect(recorded.cached_count).to eq(0)
end
......
......@@ -22,7 +22,7 @@ describe Ci::RetryBuildService, :services do
%i[type lock_version target_url base_tags
commit_id deployments erased_by_id last_deployment project_id
runner_id tag_taggings taggings tags trigger_request_id
user_id auto_canceled_by_id retried].freeze
user_id auto_canceled_by_id retried sourced_pipelines].freeze
shared_examples 'build duplication' do
let(:build) 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