diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-23 00:08:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-23 00:08:01 +0300 |
commit | c50e042a392687730db9b8c2607883485b258ae4 (patch) | |
tree | 519b069aa0a400241a2f8dc0f900f09625e3d8ed /spec/frontend/ci | |
parent | 7e2f555a6dc37839727dee130d8ed4421b680d42 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ci')
6 files changed, 28 insertions, 30 deletions
diff --git a/spec/frontend/ci/runner/components/cells/runner_status_cell_spec.js b/spec/frontend/ci/runner/components/cells/runner_status_cell_spec.js index c435dd57de2..88d4398aa70 100644 --- a/spec/frontend/ci/runner/components/cells/runner_status_cell_spec.js +++ b/spec/frontend/ci/runner/components/cells/runner_status_cell_spec.js @@ -24,7 +24,7 @@ describe('RunnerStatusCell', () => { propsData: { runner: { runnerType: INSTANCE_TYPE, - active: true, + paused: false, status: STATUS_ONLINE, jobExecutionStatus: JOB_STATUS_IDLE, ...runner, @@ -59,7 +59,7 @@ describe('RunnerStatusCell', () => { it('Displays paused status', () => { createComponent({ runner: { - active: false, + paused: true, status: STATUS_ONLINE, }, }); diff --git a/spec/frontend/ci/runner/components/runner_delete_button_spec.js b/spec/frontend/ci/runner/components/runner_delete_button_spec.js index 3123f2894fb..3b3f3b1770d 100644 --- a/spec/frontend/ci/runner/components/runner_delete_button_spec.js +++ b/spec/frontend/ci/runner/components/runner_delete_button_spec.js @@ -236,7 +236,7 @@ describe('RunnerDeleteButton', () => { createComponent({ props: { runner: { - active: true, + paused: false, }, compact: true, }, diff --git a/spec/frontend/ci/runner/components/runner_list_spec.js b/spec/frontend/ci/runner/components/runner_list_spec.js index 0f4ec717c3e..9da640afeb7 100644 --- a/spec/frontend/ci/runner/components/runner_list_spec.js +++ b/spec/frontend/ci/runner/components/runner_list_spec.js @@ -18,7 +18,6 @@ import { I18N_PROJECT_TYPE, I18N_STATUS_NEVER_CONTACTED } from '~/ci/runner/cons import { allRunnersData, onlineContactTimeoutSecs, staleTimeoutSecs } from '../mock_data'; const mockRunners = allRunnersData.data.runners.nodes; -const mockActiveRunnersCount = mockRunners.length; describe('RunnerList', () => { let wrapper; @@ -44,7 +43,6 @@ describe('RunnerList', () => { apolloProvider: createMockApollo([], {}, cacheConfig), propsData: { runners: mockRunners, - activeRunnersCount: mockActiveRunnersCount, ...props, }, provide: { diff --git a/spec/frontend/ci/runner/components/runner_pause_button_spec.js b/spec/frontend/ci/runner/components/runner_pause_button_spec.js index 350d029f3fc..1ea870e004a 100644 --- a/spec/frontend/ci/runner/components/runner_pause_button_spec.js +++ b/spec/frontend/ci/runner/components/runner_pause_button_spec.js @@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { shallowMountExtended, mountExtended } from 'helpers/vue_test_utils_helper'; -import runnerToggleActiveMutation from '~/ci/runner/graphql/shared/runner_toggle_active.mutation.graphql'; +import runnerTogglePausedMutation from '~/ci/runner/graphql/shared/runner_toggle_paused.mutation.graphql'; import waitForPromises from 'helpers/wait_for_promises'; import { captureException } from '~/ci/runner/sentry_utils'; import { createAlert } from '~/alert'; @@ -27,7 +27,7 @@ jest.mock('~/ci/runner/sentry_utils'); describe('RunnerPauseButton', () => { let wrapper; - let runnerToggleActiveHandler; + let runnerTogglePausedHandler; const getTooltip = () => getBinding(wrapper.element, 'gl-tooltip').value; const findBtn = () => wrapper.findComponent(GlButton); @@ -39,12 +39,12 @@ describe('RunnerPauseButton', () => { propsData: { runner: { id: mockRunner.id, - active: mockRunner.active, + paused: mockRunner.paused, ...runner, }, ...propsData, }, - apolloProvider: createMockApollo([[runnerToggleActiveMutation, runnerToggleActiveHandler]]), + apolloProvider: createMockApollo([[runnerTogglePausedMutation, runnerTogglePausedHandler]]), directives: { GlTooltip: createMockDirective('gl-tooltip'), }, @@ -57,13 +57,13 @@ describe('RunnerPauseButton', () => { }; beforeEach(() => { - runnerToggleActiveHandler = jest.fn().mockImplementation(({ input }) => { + runnerTogglePausedHandler = jest.fn().mockImplementation(({ input }) => { return Promise.resolve({ data: { runnerUpdate: { runner: { id: input.id, - active: input.active, + paused: !input.paused, }, errors: [], }, @@ -76,15 +76,15 @@ describe('RunnerPauseButton', () => { describe('Pause/Resume action', () => { describe.each` - runnerState | icon | content | tooltip | isActive | newActiveValue - ${'paused'} | ${'play'} | ${I18N_RESUME} | ${I18N_RESUME_TOOLTIP} | ${false} | ${true} - ${'active'} | ${'pause'} | ${I18N_PAUSE} | ${I18N_PAUSE_TOOLTIP} | ${true} | ${false} - `('When the runner is $runnerState', ({ icon, content, tooltip, isActive, newActiveValue }) => { + runnerState | icon | content | tooltip | isPaused | newPausedValue + ${'paused'} | ${'play'} | ${I18N_RESUME} | ${I18N_RESUME_TOOLTIP} | ${true} | ${false} + ${'active'} | ${'pause'} | ${I18N_PAUSE} | ${I18N_PAUSE_TOOLTIP} | ${false} | ${true} + `('When the runner is $runnerState', ({ icon, content, tooltip, isPaused, newPausedValue }) => { beforeEach(() => { createComponent({ props: { runner: { - active: isActive, + paused: isPaused, }, }, }); @@ -106,7 +106,7 @@ describe('RunnerPauseButton', () => { describe(`Before the ${icon} button is clicked`, () => { it('The mutation has not been called', () => { - expect(runnerToggleActiveHandler).toHaveBeenCalledTimes(0); + expect(runnerTogglePausedHandler).not.toHaveBeenCalled(); }); }); @@ -134,12 +134,12 @@ describe('RunnerPauseButton', () => { await clickAndWait(); }); - it(`The mutation to that sets active to ${newActiveValue} is called`, () => { - expect(runnerToggleActiveHandler).toHaveBeenCalledTimes(1); - expect(runnerToggleActiveHandler).toHaveBeenCalledWith({ + it(`The mutation to that sets "paused" to ${newPausedValue} is called`, () => { + expect(runnerTogglePausedHandler).toHaveBeenCalledTimes(1); + expect(runnerTogglePausedHandler).toHaveBeenCalledWith({ input: { id: mockRunner.id, - active: newActiveValue, + paused: newPausedValue, }, }); }); @@ -158,7 +158,7 @@ describe('RunnerPauseButton', () => { const mockErrorMsg = 'Update error!'; beforeEach(async () => { - runnerToggleActiveHandler.mockRejectedValueOnce(new Error(mockErrorMsg)); + runnerTogglePausedHandler.mockRejectedValueOnce(new Error(mockErrorMsg)); await clickAndWait(); }); @@ -180,12 +180,12 @@ describe('RunnerPauseButton', () => { const mockErrorMsg2 = 'User not allowed!'; beforeEach(async () => { - runnerToggleActiveHandler.mockResolvedValueOnce({ + runnerTogglePausedHandler.mockResolvedValueOnce({ data: { runnerUpdate: { runner: { id: mockRunner.id, - active: isActive, + paused: isPaused, }, errors: [mockErrorMsg, mockErrorMsg2], }, @@ -215,7 +215,7 @@ describe('RunnerPauseButton', () => { createComponent({ props: { runner: { - active: true, + paused: false, }, compact: true, }, diff --git a/spec/frontend/ci/runner/components/runner_update_form_spec.js b/spec/frontend/ci/runner/components/runner_update_form_spec.js index ee37d6241b5..d1d4e38f47c 100644 --- a/spec/frontend/ci/runner/components/runner_update_form_spec.js +++ b/spec/frontend/ci/runner/components/runner_update_form_spec.js @@ -56,7 +56,7 @@ describe('RunnerUpdateForm', () => { const submitFormAndWait = () => submitForm().then(waitForPromises); const getFieldsModel = () => ({ - active: !findPausedCheckbox().element.checked, + paused: findPausedCheckbox().element.checked, accessLevel: findProtectedCheckbox().element.checked ? ACCESS_LEVEL_REF_PROTECTED : ACCESS_LEVEL_NOT_PROTECTED, @@ -179,8 +179,8 @@ describe('RunnerUpdateForm', () => { describe('On submit, runner gets updated', () => { it.each` test | initialValue | findCheckbox | checked | submitted - ${'pauses'} | ${{ active: true }} | ${findPausedCheckbox} | ${true} | ${{ active: false }} - ${'activates'} | ${{ active: false }} | ${findPausedCheckbox} | ${false} | ${{ active: true }} + ${'pauses'} | ${{ paused: false }} | ${findPausedCheckbox} | ${true} | ${{ paused: true }} + ${'activates'} | ${{ paused: true }} | ${findPausedCheckbox} | ${false} | ${{ paused: false }} ${'unprotects'} | ${{ accessLevel: ACCESS_LEVEL_NOT_PROTECTED }} | ${findProtectedCheckbox} | ${true} | ${{ accessLevel: ACCESS_LEVEL_REF_PROTECTED }} ${'protects'} | ${{ accessLevel: ACCESS_LEVEL_REF_PROTECTED }} | ${findProtectedCheckbox} | ${false} | ${{ accessLevel: ACCESS_LEVEL_NOT_PROTECTED }} ${'"runs untagged jobs"'} | ${{ runUntagged: true }} | ${findRunUntaggedCheckbox} | ${false} | ${{ runUntagged: false }} diff --git a/spec/frontend/ci/runner/runner_update_form_utils_spec.js b/spec/frontend/ci/runner/runner_update_form_utils_spec.js index b2f7bbc49a9..80c492bb431 100644 --- a/spec/frontend/ci/runner/runner_update_form_utils_spec.js +++ b/spec/frontend/ci/runner/runner_update_form_utils_spec.js @@ -12,7 +12,7 @@ const mockRunner = { description: mockDescription, maximumTimeout: 100, accessLevel: ACCESS_LEVEL_NOT_PROTECTED, - active: true, + paused: false, locked: true, runUntagged: true, tagList: ['tag-1', 'tag-2'], @@ -79,7 +79,7 @@ describe('~/ci/runner/runner_update_form_utils', () => { ${',,,,, commas'} | ${['commas']} ${'more ,,,,, commas'} | ${['more', 'commas']} ${' trimmed , trimmed2 '} | ${['trimmed', 'trimmed2']} - `('collect tags separated by commas for "$value"', ({ tagList, tagListInput }) => { + `('collect comma-separated tags "$tagList" as $tagListInput', ({ tagList, tagListInput }) => { const variables = modelToUpdateMutationVariables({ ...mockModel, tagList, |