diff options
Diffstat (limited to 'qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb')
-rw-r--r-- | qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb b/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb index a2d66ffe8d3..fb530967073 100644 --- a/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb +++ b/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb @@ -8,10 +8,11 @@ module QA end after(:context) do - Vendor::Smocker::SmockerApi.teardown! + Service::DockerRun::Smocker.teardown! end let(:session) { SecureRandom.hex(5) } + let(:tag_name) { SecureRandom.hex(5) } it 'sends a push event', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348945' do setup_webhook(push: true) do |webhook, smocker| @@ -71,7 +72,7 @@ module QA end it 'sends an issues and note event', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349723' do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349723' do setup_webhook(issues: true, note: true) do |webhook, smocker| issue = Resource::Issue.fabricate_via_api! do |issue_init| issue_init.project = webhook.project @@ -98,10 +99,36 @@ module QA end end + it 'sends a tag event', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/383577' do + setup_webhook(tag_push: true) do |webhook, smocker| + project_push = Resource::Repository::ProjectPush.fabricate! do |project_push| + project_push.project = webhook.project + end + + Resource::Tag.fabricate_via_api! do |tag| + tag.project = project_push.project + tag.ref = project_push.branch_name + tag.name = tag_name + end + + wait_until do + smocker.history(session).size == 1 + end + + events = smocker.history(session).map(&:as_hook_event) + aggregate_failures do + expect(events.size).to be(1), "Should have 1 event: \n#{events.map(&:raw).join("\n")}" + expect(events[0].project_name).to eql(webhook.project.name) + expect(events[0].tag?).to be(true), "Not tag event: \n#{events[0].raw}" + end + end + end + private def setup_webhook(**event_args) - Vendor::Smocker::SmockerApi.init(wait: 10) do |smocker| + Service::DockerRun::Smocker.init(wait: 10) do |smocker| smocker.register(session: session) webhook = Resource::ProjectWebHook.fabricate_via_api! do |hook| |