diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/requests/api/terraform | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/requests/api/terraform')
-rw-r--r-- | spec/requests/api/terraform/state_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/requests/api/terraform/state_spec.rb b/spec/requests/api/terraform/state_spec.rb index b91f6e1aa88..0fa088a641e 100644 --- a/spec/requests/api/terraform/state_spec.rb +++ b/spec/requests/api/terraform/state_spec.rb @@ -113,7 +113,7 @@ RSpec.describe API::Terraform::State do end describe 'POST /projects/:id/terraform/state/:name' do - let(:params) { { 'instance': 'example-instance', 'serial': '1' } } + let(:params) { { 'instance': 'example-instance', 'serial': state.latest_version.version + 1 } } subject(:request) { post api(state_path), headers: auth_header, as: :json, params: params } @@ -202,6 +202,18 @@ RSpec.describe API::Terraform::State do end end end + + context 'when using job token authentication' do + let(:job) { create(:ci_build, status: :running, project: project, user: maintainer) } + let(:auth_header) { job_basic_auth_header(job) } + + it 'associates the job with the newly created state version' do + expect { request }.to change { state.versions.count }.by(1) + + expect(response).to have_gitlab_http_status(:ok) + expect(state.reload_latest_version.build).to eq(job) + end + end end describe 'DELETE /projects/:id/terraform/state/:name' do |