diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-29 07:12:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-29 07:12:44 +0000 |
commit | 6a4f265c940d3d0a9aeacf09222920d7d2cc4e45 (patch) | |
tree | 4cf73897e78f8fee50e39edb7d74fa628b6a87da /spec | |
parent | cba453953c1598f83b2ed72bc012b65e0df5b767 (diff) | |
download | gitlab-ce-6a4f265c940d3d0a9aeacf09222920d7d2cc4e45.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec')
5 files changed, 40 insertions, 21 deletions
diff --git a/spec/controllers/projects/artifacts_controller_spec.rb b/spec/controllers/projects/artifacts_controller_spec.rb index be616b566dd..4c815a5b40c 100644 --- a/spec/controllers/projects/artifacts_controller_spec.rb +++ b/spec/controllers/projects/artifacts_controller_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' describe Projects::ArtifactsController do + include RepoHelpers + let(:user) { project.owner } let_it_be(:project) { create(:project, :repository, :public) } @@ -481,6 +483,22 @@ describe Projects::ArtifactsController do expect(response).to redirect_to(path) end end + + context 'with a failed pipeline on an updated master' do + before do + create_file_in_repo(project, 'master', 'master', 'test.txt', 'This is test') + + create(:ci_pipeline, + project: project, + sha: project.commit.sha, + ref: project.default_branch, + status: 'failed') + + get :latest_succeeded, params: params_from_ref(project.default_branch) + end + + it_behaves_like 'redirect to the job' + end end end end diff --git a/spec/controllers/projects/environments/prometheus_api_controller_spec.rb b/spec/controllers/projects/environments/prometheus_api_controller_spec.rb index 64f90e44bb6..fb8da52930c 100644 --- a/spec/controllers/projects/environments/prometheus_api_controller_spec.rb +++ b/spec/controllers/projects/environments/prometheus_api_controller_spec.rb @@ -84,12 +84,12 @@ describe Projects::Environments::PrometheusApiController do before do expected_params[:query] = %{up{pod_name="#{pod_name}"}} - expected_params[:variables] = ['pod_name', pod_name] + expected_params[:variables] = { 'pod_name' => pod_name } end it 'replaces variables with values' do get :proxy, params: environment_params.merge( - query: 'up{pod_name="{{pod_name}}"}', variables: ['pod_name', pod_name] + query: 'up{pod_name="{{pod_name}}"}', variables: { 'pod_name' => pod_name } ) expect(response).to have_gitlab_http_status(:success) diff --git a/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb b/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb index 3cbf276c02d..78ff89799ad 100644 --- a/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb +++ b/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb @@ -32,5 +32,11 @@ describe "User downloads artifacts" do it_behaves_like "downloading" end + + context "via SHA" do + let(:url) { latest_succeeded_project_artifacts_path(project, "#{pipeline.sha}/download", job: job.name) } + + it_behaves_like "downloading" + end end end diff --git a/spec/frontend/monitoring/store/getters_spec.js b/spec/frontend/monitoring/store/getters_spec.js index 365052e68e3..19ca001c281 100644 --- a/spec/frontend/monitoring/store/getters_spec.js +++ b/spec/frontend/monitoring/store/getters_spec.js @@ -329,7 +329,7 @@ describe('Monitoring store Getters', () => { }); }); - describe('getCustomVariablesArray', () => { + describe('getCustomVariablesParams', () => { let state; beforeEach(() => { @@ -340,25 +340,21 @@ describe('Monitoring store Getters', () => { it('transforms the promVariables object to an array in the [variable, variable_value] format for all variable types', () => { mutations[types.SET_VARIABLES](state, mockTemplatingDataResponses.allVariableTypes); - const variablesArray = getters.getCustomVariablesArray(state); - - expect(variablesArray).toEqual([ - 'simpleText', - 'Simple text', - 'advText', - 'default', - 'simpleCustom', - 'value1', - 'advCustomNormal', - 'value2', - ]); + const variablesArray = getters.getCustomVariablesParams(state); + + expect(variablesArray).toEqual({ + 'variables[advCustomNormal]': 'value2', + 'variables[advText]': 'default', + 'variables[simpleCustom]': 'value1', + 'variables[simpleText]': 'Simple text', + }); }); it('transforms the promVariables object to an empty array when no keys are present', () => { mutations[types.SET_VARIABLES](state, {}); - const variablesArray = getters.getCustomVariablesArray(state); + const variablesArray = getters.getCustomVariablesParams(state); - expect(variablesArray).toEqual([]); + expect(variablesArray).toEqual({}); }); }); diff --git a/spec/services/prometheus/proxy_variable_substitution_service_spec.rb b/spec/services/prometheus/proxy_variable_substitution_service_spec.rb index 82ea356d599..5982dcbc404 100644 --- a/spec/services/prometheus/proxy_variable_substitution_service_spec.rb +++ b/spec/services/prometheus/proxy_variable_substitution_service_spec.rb @@ -64,7 +64,7 @@ describe Prometheus::ProxyVariableSubstitutionService do let(:params_keys) do { query: 'up{pod_name="{{pod_name}}"}', - variables: ['pod_name', pod_name] + variables: { 'pod_name' => pod_name } } end @@ -76,7 +76,7 @@ describe Prometheus::ProxyVariableSubstitutionService do let(:params_keys) do { query: 'up{pod_name="{{pod_name}}",env="{{ci_environment_slug}}"}', - variables: ['pod_name', pod_name, 'ci_environment_slug', 'custom_value'] + variables: { 'pod_name' => pod_name, 'ci_environment_slug' => 'custom_value' } } end @@ -95,8 +95,7 @@ describe Prometheus::ProxyVariableSubstitutionService do } end - it_behaves_like 'error', 'Optional parameter "variables" must be an ' \ - 'array of keys and values. Ex: [key1, value1, key2, value2]' + it_behaves_like 'error', 'Optional parameter "variables" must be a Hash. Ex: variables[key1]=value1' end context 'with nil variables' do |