diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bin/changelog_spec.rb | 8 | ||||
-rw-r--r-- | spec/frontend/jobs/store/utils_spec.js | 16 | ||||
-rw-r--r-- | spec/javascripts/jobs/components/log/duration_badge_spec.js | 31 | ||||
-rw-r--r-- | spec/javascripts/jobs/components/log/line_header_spec.js | 11 | ||||
-rw-r--r-- | spec/services/ci/create_pipeline_service_spec.rb | 41 | ||||
-rw-r--r-- | spec/views/help/index.html.haml_spec.rb | 4 |
6 files changed, 74 insertions, 37 deletions
diff --git a/spec/bin/changelog_spec.rb b/spec/bin/changelog_spec.rb index c3a5abf2b7a..ce7f7648c0c 100644 --- a/spec/bin/changelog_spec.rb +++ b/spec/bin/changelog_spec.rb @@ -69,6 +69,14 @@ describe 'bin/changelog' do end end + it 'parses --ee and -e' do + %w[--ee -e].each do |flag| + options = described_class.parse(%W[foo #{flag} security]) + + expect(options.ee).to eq true + end + end + it 'parses -h' do expect do expect { described_class.parse(%w[foo -h bar]) }.to output.to_stdout diff --git a/spec/frontend/jobs/store/utils_spec.js b/spec/frontend/jobs/store/utils_spec.js index 1b96f95b5a5..7b484ccfa07 100644 --- a/spec/frontend/jobs/store/utils_spec.js +++ b/spec/frontend/jobs/store/utils_spec.js @@ -28,6 +28,12 @@ describe('Jobs Store Utils', () => { content: [{ text: 'Pulling docker image postgres:9.6.14 ...', style: 'term-fg-l-green' }], sections: ['prepare-executor'], }, + { + offset: 1005, + content: [], + sections: ['prepare-executor'], + section_duration: '10:00', + }, ]; let result; @@ -58,6 +64,16 @@ describe('Jobs Store Utils', () => { expect(result[1].lines[1].content).toEqual(mockData[3].content); }); }); + + describe('section duration', () => { + it('adds the section information to the header section', () => { + expect(result[1].section_duration).toEqual(mockData[4].section_duration); + }); + + it('does not add section duration as a line', () => { + expect(result[1].lines.includes(mockData[4])).toEqual(false); + }); + }); }); describe('updateIncrementalTrace', () => { diff --git a/spec/javascripts/jobs/components/log/duration_badge_spec.js b/spec/javascripts/jobs/components/log/duration_badge_spec.js new file mode 100644 index 00000000000..2ac34e78909 --- /dev/null +++ b/spec/javascripts/jobs/components/log/duration_badge_spec.js @@ -0,0 +1,31 @@ +import { shallowMount } from '@vue/test-utils'; +import DurationBadge from '~/jobs/components/log/duration_badge.vue'; + +describe('Job Log Duration Badge', () => { + let wrapper; + + const data = { + duration: '00:30:01', + }; + + const createComponent = (props = {}) => { + wrapper = shallowMount(DurationBadge, { + sync: false, + propsData: { + ...props, + }, + }); + }; + + beforeEach(() => { + createComponent(data); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + it('renders provided duration', () => { + expect(wrapper.text()).toBe(data.duration); + }); +}); diff --git a/spec/javascripts/jobs/components/log/line_header_spec.js b/spec/javascripts/jobs/components/log/line_header_spec.js index 4efd412a6cd..2d2f92fad9d 100644 --- a/spec/javascripts/jobs/components/log/line_header_spec.js +++ b/spec/javascripts/jobs/components/log/line_header_spec.js @@ -1,6 +1,7 @@ import { mount } from '@vue/test-utils'; import LineHeader from '~/jobs/components/log/line_header.vue'; import LineNumber from '~/jobs/components/log/line_number.vue'; +import DurationBadge from '~/jobs/components/log/duration_badge.vue'; describe('Job Log Header Line', () => { let wrapper; @@ -81,4 +82,14 @@ describe('Job Log Header Line', () => { expect(wrapper.emitted().toggleLine.length).toBe(1); }); }); + + describe('with duration', () => { + beforeEach(() => { + createComponent(Object.assign({}, data, { duration: '00:10' })); + }); + + it('renders the duration badge', () => { + expect(wrapper.contains(DurationBadge)).toBe(true); + }); + }); }); diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 6eafe122697..1a5fdac1c95 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -287,51 +287,21 @@ describe Ci::CreatePipelineService do expect(pipeline.builds.find_by(name: 'rspec').interruptible).to be_falsy end end - - context 'not defined, but an environment is' do - before do - config = YAML.dump(rspec: { script: 'echo', environment: { name: "review/$CI_COMMIT_REF_NAME" } }) - stub_ci_pipeline_yaml_file(config) - end - - it 'is not cancelable' do - pipeline = execute_service - - expect(pipeline.builds.find_by(name: 'rspec').interruptible).to be_nil - end - end - - context 'overriding the environment definition' do - before do - config = YAML.dump(rspec: { script: 'echo', environment: { name: "review/$CI_COMMIT_REF_NAME" }, interruptible: true }) - stub_ci_pipeline_yaml_file(config) - end - - it 'is cancelable' do - pipeline = execute_service - - expect(pipeline.builds.find_by(name: 'rspec').interruptible).to be_truthy - end - end end context 'interruptible builds' do before do - Feature.enable(:ci_support_interruptible_pipelines) stub_ci_pipeline_yaml_file(YAML.dump(config)) end - after do - Feature.disable(:ci_support_interruptible_pipelines) - end - let(:config) do { stages: %w[stage1 stage2 stage3 stage4], build_1_1: { stage: 'stage1', - script: 'echo' + script: 'echo', + interruptible: true }, build_1_2: { stage: 'stage1', @@ -342,7 +312,8 @@ describe Ci::CreatePipelineService do stage: 'stage2', script: 'echo', when: 'delayed', - start_in: '10 minutes' + start_in: '10 minutes', + interruptible: true }, build_3_1: { stage: 'stage3', @@ -364,9 +335,9 @@ describe Ci::CreatePipelineService do .pluck(:name, 'ci_builds_metadata.interruptible') expect(interruptible_status).to contain_exactly( - ['build_1_1', nil], + ['build_1_1', true], ['build_1_2', true], - ['build_2_1', nil], + ['build_2_1', true], ['build_3_1', false], ['build_4_1', nil] ) diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb index f25e05dca7f..474a294ce0d 100644 --- a/spec/views/help/index.html.haml_spec.rb +++ b/spec/views/help/index.html.haml_spec.rb @@ -31,7 +31,7 @@ describe 'help/index' do render expect(rendered).to match '8.0.2' - expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/-/tags/v8.0.2}) + expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/(gitlab|gitlab-foss)/-/tags/v8.0.2}) end it 'shows a link to the commit for pre-releases' do @@ -40,7 +40,7 @@ describe 'help/index' do render expect(rendered).to match '8.0.2' - expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/commits/abcdefg}) + expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/(gitlab|gitlab-foss)/commits/abcdefg}) end end end |