diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-15 21:08:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-15 21:08:48 +0000 |
commit | 600ca978129e3ccab758f57d60786cefe66ad775 (patch) | |
tree | a3675da98c7c245adf7e93f82f9c26a38cc3c29d /spec | |
parent | 571d993b49313dd806bd3f6af16d36c26d9d28ca (diff) | |
download | gitlab-ce-600ca978129e3ccab758f57d60786cefe66ad775.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/db/schema_spec.rb | 2 | ||||
-rw-r--r-- | spec/fixtures/referees/metrics_referee.json.gz | bin | 0 -> 568 bytes | |||
-rw-r--r-- | spec/fixtures/referees/network_referee.json.gz | bin | 0 -> 568 bytes | |||
-rw-r--r-- | spec/frontend/error_tracking/components/error_details_spec.js | 10 | ||||
-rw-r--r-- | spec/lib/gitlab/diff/file_spec.rb | 10 | ||||
-rw-r--r-- | spec/requests/api/runner_spec.rb | 52 | ||||
-rw-r--r-- | spec/services/ci/retry_build_service_spec.rb | 3 | ||||
-rw-r--r-- | spec/views/projects/diffs/_viewer.html.haml_spec.rb | 12 |
8 files changed, 77 insertions, 12 deletions
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 17c40bec6c6..482e0fbe7ce 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -34,7 +34,7 @@ describe 'Database schema' do draft_notes: %w[discussion_id commit_id], emails: %w[user_id], events: %w[target_id], - epics: %w[updated_by_id last_edited_by_id start_date_sourcing_milestone_id due_date_sourcing_milestone_id state_id], + epics: %w[updated_by_id last_edited_by_id state_id], forked_project_links: %w[forked_from_project_id], geo_event_log: %w[hashed_storage_attachments_event_id], geo_job_artifact_deleted_events: %w[job_artifact_id], diff --git a/spec/fixtures/referees/metrics_referee.json.gz b/spec/fixtures/referees/metrics_referee.json.gz Binary files differnew file mode 100644 index 00000000000..88b7de6fa61 --- /dev/null +++ b/spec/fixtures/referees/metrics_referee.json.gz diff --git a/spec/fixtures/referees/network_referee.json.gz b/spec/fixtures/referees/network_referee.json.gz Binary files differnew file mode 100644 index 00000000000..88b7de6fa61 --- /dev/null +++ b/spec/fixtures/referees/network_referee.json.gz diff --git a/spec/frontend/error_tracking/components/error_details_spec.js b/spec/frontend/error_tracking/components/error_details_spec.js index d62bda78e9a..e876a6da922 100644 --- a/spec/frontend/error_tracking/components/error_details_spec.js +++ b/spec/frontend/error_tracking/components/error_details_spec.js @@ -198,6 +198,7 @@ describe('ErrorDetails', () => { const gitlabIssue = 'https://gitlab.example.com/issues/1'; const findGitLabLink = () => wrapper.find(`[href="${gitlabIssue}"]`); const findCreateIssueButton = () => wrapper.find('[data-qa-selector="create_issue_button"]'); + const findViewIssueButton = () => wrapper.find('[data-qa-selector="view_issue_button"]'); describe('is present', () => { beforeEach(() => { @@ -209,6 +210,10 @@ describe('ErrorDetails', () => { mountComponent(); }); + it('should display the View issue button', () => { + expect(findViewIssueButton().exists()).toBe(true); + }); + it('should display the issue link', () => { expect(findGitLabLink().exists()).toBe(true); }); @@ -228,9 +233,14 @@ describe('ErrorDetails', () => { mountComponent(); }); + it('should not display the View issue button', () => { + expect(findViewIssueButton().exists()).toBe(false); + }); + it('should not display an issue link', () => { expect(findGitLabLink().exists()).toBe(false); }); + it('should display the create issue button', () => { expect(findCreateIssueButton().exists()).toBe(true); }); diff --git a/spec/lib/gitlab/diff/file_spec.rb b/spec/lib/gitlab/diff/file_spec.rb index 716fc8ae987..c468af4db68 100644 --- a/spec/lib/gitlab/diff/file_spec.rb +++ b/spec/lib/gitlab/diff/file_spec.rb @@ -347,6 +347,16 @@ describe Gitlab::Diff::File do end describe '#simple_viewer' do + context 'when the file is collapsed' do + before do + allow(diff_file).to receive(:collapsed?).and_return(true) + end + + it 'returns a Collapsed viewer' do + expect(diff_file.simple_viewer).to be_a(DiffViewer::Collapsed) + end + end + context 'when the file is not diffable' do before do allow(diff_file).to receive(:diffable?).and_return(false) diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index 93b35401706..a313f75e3ec 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -1828,6 +1828,58 @@ describe API::Runner, :clean_gitlab_redis_shared_state do end end end + + context 'when artifact_type is metrics_referee' do + context 'when artifact_format is gzip' do + let(:file_upload) { fixture_file_upload('spec/fixtures/referees/metrics_referee.json.gz') } + let(:params) { { artifact_type: :metrics_referee, artifact_format: :gzip } } + + it 'stores metrics_referee data' do + upload_artifacts(file_upload, headers_with_token, params) + + expect(response).to have_gitlab_http_status(201) + expect(job.reload.job_artifacts_metrics_referee).not_to be_nil + end + end + + context 'when artifact_format is raw' do + let(:file_upload) { fixture_file_upload('spec/fixtures/referees/metrics_referee.json.gz') } + let(:params) { { artifact_type: :metrics_referee, artifact_format: :raw } } + + it 'returns an error' do + upload_artifacts(file_upload, headers_with_token, params) + + expect(response).to have_gitlab_http_status(400) + expect(job.reload.job_artifacts_metrics_referee).to be_nil + end + end + end + + context 'when artifact_type is network_referee' do + context 'when artifact_format is gzip' do + let(:file_upload) { fixture_file_upload('spec/fixtures/referees/network_referee.json.gz') } + let(:params) { { artifact_type: :network_referee, artifact_format: :gzip } } + + it 'stores network_referee data' do + upload_artifacts(file_upload, headers_with_token, params) + + expect(response).to have_gitlab_http_status(201) + expect(job.reload.job_artifacts_network_referee).not_to be_nil + end + end + + context 'when artifact_format is raw' do + let(:file_upload) { fixture_file_upload('spec/fixtures/referees/network_referee.json.gz') } + let(:params) { { artifact_type: :network_referee, artifact_format: :raw } } + + it 'returns an error' do + upload_artifacts(file_upload, headers_with_token, params) + + expect(response).to have_gitlab_http_status(400) + expect(job.reload.job_artifacts_network_referee).to be_nil + end + end + end end context 'when artifacts are being stored outside of tmp path' do diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb index e5933330de5..1a39b37e925 100644 --- a/spec/services/ci/retry_build_service_spec.rb +++ b/spec/services/ci/retry_build_service_spec.rb @@ -35,7 +35,8 @@ describe Ci::RetryBuildService do job_artifacts_license_management job_artifacts_license_scanning job_artifacts_performance job_artifacts_codequality job_artifacts_metrics scheduled_at - job_variables waiting_for_resource_at].freeze + job_variables waiting_for_resource_at job_artifacts_metrics_referee + job_artifacts_network_referee].freeze IGNORE_ACCESSORS = %i[type lock_version target_url base_tags trace_sections diff --git a/spec/views/projects/diffs/_viewer.html.haml_spec.rb b/spec/views/projects/diffs/_viewer.html.haml_spec.rb index 1d5d6e1e78d..27f271bb178 100644 --- a/spec/views/projects/diffs/_viewer.html.haml_spec.rb +++ b/spec/views/projects/diffs/_viewer.html.haml_spec.rb @@ -9,15 +9,7 @@ describe 'projects/diffs/_viewer.html.haml' do let(:commit) { project.commit('570e7b2abdd848b95f2f578043fc23bd6f6fd24d') } let(:diff_file) { commit.diffs.diff_file_with_new_path('files/ruby/popen.rb') } - let(:viewer_class) do - Class.new(DiffViewer::Base) do - include DiffViewer::Rich - - self.partial_name = 'text' - end - end - - let(:viewer) { viewer_class.new(diff_file) } + let(:viewer) { diff_file.simple_viewer } before do assign(:project, project) @@ -53,7 +45,7 @@ describe 'projects/diffs/_viewer.html.haml' do it 'renders the collapsed view' do render_view - expect(view).to render_template('projects/diffs/_collapsed') + expect(view).to render_template('projects/diffs/viewers/_collapsed') end end |