diff options
Diffstat (limited to 'spec/requests/api/runner_spec.rb')
-rw-r--r-- | spec/requests/api/runner_spec.rb | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index bc3a04420f9..70a95663aea 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe API::Runner, :clean_gitlab_redis_shared_state do include StubGitlabCalls include RedisHelpers + include WorkhorseHelpers let(:registration_token) { 'abcdefg123456' } @@ -1395,7 +1396,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do expect(response).to have_gitlab_http_status(200) expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) - expect(json_response['TempPath']).to eq(JobArtifactUploader.workhorse_local_upload_path) + expect(json_response).not_to have_key('TempPath') expect(json_response['RemoteObject']).to have_key('ID') expect(json_response['RemoteObject']).to have_key('GetURL') expect(json_response['RemoteObject']).to have_key('StoreURL') @@ -1562,15 +1563,16 @@ describe API::Runner, :clean_gitlab_redis_shared_state do let!(:fog_connection) do stub_artifacts_object_storage(direct_upload: true) end - - before do + let(:object) do fog_connection.directories.new(key: 'artifacts').files.create( key: 'tmp/uploads/12312300', body: 'content' ) + end + let(:file_upload) { fog_to_uploaded_file(object) } - upload_artifacts(file_upload, headers_with_token, - { 'file.remote_id' => remote_id }) + before do + upload_artifacts(file_upload, headers_with_token, 'file.remote_id' => remote_id) end context 'when valid remote_id is used' do @@ -1804,12 +1806,13 @@ describe API::Runner, :clean_gitlab_redis_shared_state do end def upload_artifacts(file, headers = {}, params = {}) - params = params.merge({ - 'file.path' => file.path, - 'file.name' => file.original_filename - }) - - post api("/jobs/#{job.id}/artifacts"), params: params, headers: headers + workhorse_finalize( + api("/jobs/#{job.id}/artifacts"), + method: :post, + file_key: :file, + params: params.merge(file: file), + headers: headers + ) end end |