diff options
Diffstat (limited to 'spec/lib/gitlab/ci/config/external')
5 files changed, 73 insertions, 9 deletions
diff --git a/spec/lib/gitlab/ci/config/external/file/local_spec.rb b/spec/lib/gitlab/ci/config/external/file/local_spec.rb index c0a0b0009ce..0e78498c98e 100644 --- a/spec/lib/gitlab/ci/config/external/file/local_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/local_spec.rb @@ -199,6 +199,8 @@ RSpec.describe Gitlab::Ci::Config::External::File::Local do context_sha: '12345', type: :local, location: location, + blob: "http://localhost/#{project.full_path}/-/blob/12345/lib/gitlab/ci/templates/existent-file.yml", + raw: "http://localhost/#{project.full_path}/-/raw/12345/lib/gitlab/ci/templates/existent-file.yml", extra: {} ) } diff --git a/spec/lib/gitlab/ci/config/external/file/project_spec.rb b/spec/lib/gitlab/ci/config/external/file/project_spec.rb index 5d3412a148b..77e542cf933 100644 --- a/spec/lib/gitlab/ci/config/external/file/project_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/project_spec.rb @@ -207,6 +207,8 @@ RSpec.describe Gitlab::Ci::Config::External::File::Project do context_sha: '12345', type: :file, location: '/file.yml', + blob: "http://localhost/#{project.full_path}/-/blob/#{project.commit('master').id}/file.yml", + raw: "http://localhost/#{project.full_path}/-/raw/#{project.commit('master').id}/file.yml", extra: { project: project.full_path, ref: 'HEAD' } ) } @@ -227,6 +229,8 @@ RSpec.describe Gitlab::Ci::Config::External::File::Project do context_sha: '12345', type: :file, location: '/file.yml', + blob: nil, + raw: nil, extra: { project: 'xxxxxxxxxxxxxxxxxxxxxxxx', ref: 'xxxxxxxxxxxxxxxxxxxxxxxx' } ) } diff --git a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb index 5c07c87fd5a..3e1c4df4e32 100644 --- a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb @@ -213,6 +213,8 @@ RSpec.describe Gitlab::Ci::Config::External::File::Remote do context_sha: '12345', type: :remote, location: 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.xxxxxxxxxxx.yml', + raw: 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.xxxxxxxxxxx.yml', + blob: nil, extra: {} ) } diff --git a/spec/lib/gitlab/ci/config/external/file/template_spec.rb b/spec/lib/gitlab/ci/config/external/file/template_spec.rb index 4da9a933a9f..074e7a1d32d 100644 --- a/spec/lib/gitlab/ci/config/external/file/template_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/template_spec.rb @@ -124,6 +124,8 @@ RSpec.describe Gitlab::Ci::Config::External::File::Template do context_sha: '12345', type: :template, location: template, + raw: "https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/templates/#{template}", + blob: nil, extra: {} ) } diff --git a/spec/lib/gitlab/ci/config/external/processor_spec.rb b/spec/lib/gitlab/ci/config/external/processor_spec.rb index 56cd006717e..15a0ff40aa4 100644 --- a/spec/lib/gitlab/ci/config/external/processor_spec.rb +++ b/spec/lib/gitlab/ci/config/external/processor_spec.rb @@ -267,11 +267,41 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do perform expect(context.includes).to contain_exactly( - { type: :local, location: '/local/file.yml', extra: {}, context_project: project.full_path, context_sha: '12345' }, - { type: :template, location: 'Ruby.gitlab-ci.yml', extra: {}, context_project: project.full_path, context_sha: '12345' }, - { type: :remote, location: 'http://my.domain.com/config.yml', extra: {}, context_project: project.full_path, context_sha: '12345' }, - { type: :file, location: '/templates/my-workflow.yml', extra: { project: another_project.full_path, ref: 'HEAD' }, context_project: project.full_path, context_sha: '12345' }, - { type: :local, location: '/templates/my-build.yml', extra: {}, context_project: another_project.full_path, context_sha: another_project.commit.sha } + { type: :local, + location: '/local/file.yml', + blob: "http://localhost/#{project.full_path}/-/blob/12345/local/file.yml", + raw: "http://localhost/#{project.full_path}/-/raw/12345/local/file.yml", + extra: {}, + context_project: project.full_path, + context_sha: '12345' }, + { type: :template, + location: 'Ruby.gitlab-ci.yml', + blob: nil, + raw: 'https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/templates/Ruby.gitlab-ci.yml', + extra: {}, + context_project: project.full_path, + context_sha: '12345' }, + { type: :remote, + location: 'http://my.domain.com/config.yml', + blob: nil, + raw: "http://my.domain.com/config.yml", + extra: {}, + context_project: project.full_path, + context_sha: '12345' }, + { type: :file, + location: '/templates/my-workflow.yml', + blob: "http://localhost/#{another_project.full_path}/-/blob/#{another_project.commit.sha}/templates/my-workflow.yml", + raw: "http://localhost/#{another_project.full_path}/-/raw/#{another_project.commit.sha}/templates/my-workflow.yml", + extra: { project: another_project.full_path, ref: 'HEAD' }, + context_project: project.full_path, + context_sha: '12345' }, + { type: :local, + location: '/templates/my-build.yml', + blob: "http://localhost/#{another_project.full_path}/-/blob/#{another_project.commit.sha}/templates/my-build.yml", + raw: "http://localhost/#{another_project.full_path}/-/raw/#{another_project.commit.sha}/templates/my-build.yml", + extra: {}, + context_project: another_project.full_path, + context_sha: another_project.commit.sha } ) end end @@ -394,8 +424,20 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do perform expect(context.includes).to contain_exactly( - { type: :file, location: '/templates/my-build.yml', extra: { project: another_project.full_path, ref: 'HEAD' }, context_project: project.full_path, context_sha: '12345' }, - { type: :file, location: '/templates/my-test.yml', extra: { project: another_project.full_path, ref: 'HEAD' }, context_project: project.full_path, context_sha: '12345' } + { type: :file, + location: '/templates/my-build.yml', + blob: "http://localhost/#{another_project.full_path}/-/blob/#{another_project.commit.sha}/templates/my-build.yml", + raw: "http://localhost/#{another_project.full_path}/-/raw/#{another_project.commit.sha}/templates/my-build.yml", + extra: { project: another_project.full_path, ref: 'HEAD' }, + context_project: project.full_path, + context_sha: '12345' }, + { type: :file, + blob: "http://localhost/#{another_project.full_path}/-/blob/#{another_project.commit.sha}/templates/my-test.yml", + raw: "http://localhost/#{another_project.full_path}/-/raw/#{another_project.commit.sha}/templates/my-test.yml", + location: '/templates/my-test.yml', + extra: { project: another_project.full_path, ref: 'HEAD' }, + context_project: project.full_path, + context_sha: '12345' } ) end end @@ -438,8 +480,20 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do perform expect(context.includes).to contain_exactly( - { type: :local, location: 'myfolder/file1.yml', extra: {}, context_project: project.full_path, context_sha: '12345' }, - { type: :local, location: 'myfolder/file2.yml', extra: {}, context_project: project.full_path, context_sha: '12345' } + { type: :local, + location: 'myfolder/file1.yml', + blob: "http://localhost/#{project.full_path}/-/blob/12345/myfolder/file1.yml", + raw: "http://localhost/#{project.full_path}/-/raw/12345/myfolder/file1.yml", + extra: {}, + context_project: project.full_path, + context_sha: '12345' }, + { type: :local, + blob: "http://localhost/#{project.full_path}/-/blob/12345/myfolder/file2.yml", + raw: "http://localhost/#{project.full_path}/-/raw/12345/myfolder/file2.yml", + location: 'myfolder/file2.yml', + extra: {}, + context_project: project.full_path, + context_sha: '12345' } ) end end |