diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
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| |