summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG2
-rw-r--r--doc/development/testing.md1
-rw-r--r--lib/gitlab/bitbucket_import/client.rb2
-rw-r--r--lib/tasks/gitlab/db.rake5
-rw-r--r--spec/lib/gitlab/bitbucket_import/client_spec.rb26
5 files changed, 27 insertions, 9 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 769ffb2476a..99e294c9ae1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -18,7 +18,7 @@ v 8.8.0 (unreleased)
- Display informative message when new milestone is created
- Allow "NEWS" and "CHANGES" as alternative names for CHANGELOG. !3768 (Connor Shea)
- Added button to toggle whitespaces changes on diff view
- - Backport GitLab Enterprise support from EE
+ - Backport GitHub Enterprise import support from EE
- Create tags using Rugged for performance reasons. !3745
- Files over 5MB can only be viewed in their raw form, files over 1MB without highlighting !3718
- Add support for supressing text diffs using .gitattributes on the default branch (Matt Oakes)
diff --git a/doc/development/testing.md b/doc/development/testing.md
index 672e3fb4649..33eed29ba5c 100644
--- a/doc/development/testing.md
+++ b/doc/development/testing.md
@@ -64,6 +64,7 @@ the command line via `bundle exec teaspoon`, or via a web browser at
methods.
- Use `context` to test branching logic.
- Don't `describe` symbols (see [Gotchas](gotchas.md#dont-describe-symbols)).
+- Don't supply the `:each` argument to hooks since it's the default.
- Prefer `not_to` to `to_not`.
- Try to match the ordering of tests to the ordering within the class.
- Try to follow the [Four-Phase Test][four-phase-test] pattern, using newlines
diff --git a/lib/gitlab/bitbucket_import/client.rb b/lib/gitlab/bitbucket_import/client.rb
index 9bb507b5edd..9b83292ef33 100644
--- a/lib/gitlab/bitbucket_import/client.rb
+++ b/lib/gitlab/bitbucket_import/client.rb
@@ -12,7 +12,7 @@ module Gitlab
token_secret = import_data_credentials[:bb_session][:bitbucket_access_token_secret]
new(token, token_secret)
else
- raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}"
+ raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{project.id}"
end
end
diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake
index 4921c6e0bcf..1c706dc11b3 100644
--- a/lib/tasks/gitlab/db.rake
+++ b/lib/tasks/gitlab/db.rake
@@ -29,7 +29,10 @@ namespace :gitlab do
tables.delete 'schema_migrations'
# Truncate schema_migrations to ensure migrations re-run
connection.execute('TRUNCATE schema_migrations')
- tables.each { |t| connection.execute("DROP TABLE #{t}") }
+ # Drop tables with cascade to avoid dependent table errors
+ # PG: http://www.postgresql.org/docs/current/static/ddl-depend.html
+ # MySQL: http://dev.mysql.com/doc/refman/5.7/en/drop-table.html
+ tables.each { |t| connection.execute("DROP TABLE #{t} CASCADE") }
end
end
end
diff --git a/spec/lib/gitlab/bitbucket_import/client_spec.rb b/spec/lib/gitlab/bitbucket_import/client_spec.rb
index aa0699f2ebf..af839f42421 100644
--- a/spec/lib/gitlab/bitbucket_import/client_spec.rb
+++ b/spec/lib/gitlab/bitbucket_import/client_spec.rb
@@ -34,18 +34,32 @@ describe Gitlab::BitbucketImport::Client, lib: true do
it 'retrieves issues over a number of pages' do
stub_request(:get,
"https://bitbucket.org/api/1.0/repositories/#{project_id}/issues?limit=50&sort=utc_created_on&start=0").
- to_return(status: 200,
- body: first_sample_data.to_json,
- headers: {})
+ to_return(status: 200,
+ body: first_sample_data.to_json,
+ headers: {})
stub_request(:get,
"https://bitbucket.org/api/1.0/repositories/#{project_id}/issues?limit=50&sort=utc_created_on&start=50").
- to_return(status: 200,
- body: second_sample_data.to_json,
- headers: {})
+ to_return(status: 200,
+ body: second_sample_data.to_json,
+ headers: {})
issues = client.issues(project_id)
expect(issues.count).to eq(95)
end
end
+
+ context 'project import' do
+ it 'calls .from_project with no errors' do
+ project = create(:empty_project)
+ project.create_or_update_import_data(credentials:
+ { user: "git",
+ password: nil,
+ bb_session: { bitbucket_access_token: "test",
+ bitbucket_access_token_secret: "test" } })
+ project.import_url = "ssh://git@bitbucket.org/test/test.git"
+
+ expect { described_class.from_project(project) }.to_not raise_error
+ end
+ end
end