blob: 0bbb0ed897aca2ef8db03d6feef3e629eb2c56e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# frozen_string_literal: true
module QA
RSpec.describe 'Verify' do
include Support::Api
let(:api_client) { Runtime::API::Client.new(:gitlab) }
describe 'Pipeline', :runner do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project-with-pipeline'
end
end
let!(:runner) do
Resource::Runner.fabricate! do |runner|
runner.project = project
runner.name = project.name
runner.tags = [project.name]
end
end
let!(:ci_file) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files(
[
{
file_path: '.gitlab-ci.yml',
content: <<~YAML
job1:
tags:
- #{project.name}
script: echo 'OK'
YAML
}
]
)
end
end
let!(:pipeline_id) do
pipeline_create_request = Runtime::API::Request.new(api_client, "/projects/#{project.id}/pipeline?ref=master")
JSON.parse(post(pipeline_create_request.url, nil))['id']
end
let(:pipeline_data_request) { Runtime::API::Request.new(api_client, "/projects/#{project.id}/pipelines/#{pipeline_id}") }
before do
Support::Waiter.wait_until(sleep_interval: 3) { !pipeline.empty? && pipeline['status'] != 'pending' }
end
after do
runner.remove_via_api!
end
context 'when deleted via API' do
it 'is not found', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/931' do
delete(pipeline_data_request.url)
deleted_pipeline = nil
Support::Waiter.wait_until(sleep_interval: 3) do
deleted_pipeline = pipeline
!pipeline.empty?
end
expect(deleted_pipeline['message'].downcase).to have_content('404 not found')
end
end
private
def pipeline
JSON.parse(get(pipeline_data_request.url))
end
end
end
end
|