Browse Source

Maintenance: Stabilize MS Teams test.

Martin Gruner 1 year ago
parent
commit
d29b612f9e

+ 1 - 1
spec/models/webhook/pre_defined/microsoft_teams_spec.rb

@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-RSpec.describe 'Webhook > MS Teams', integration: true, performs_jobs: true, required_envs: %w[MS_TEAMS_CI_WEBHOOK_URL] do # rubocop:disable RSpec/DescribeClass
+RSpec.describe 'Webhook > MS Teams', integration: true, performs_jobs: true, required_envs: %w[MS_TEAMS_CI_WEBHOOK_URL], retry: 5, retry_wait: 30.seconds, use_vcr: true do # rubocop:disable RSpec/DescribeClass
   let(:webhook)   { create(:ms_teams_webhook, endpoint: ENV['MS_TEAMS_CI_WEBHOOK_URL']) }
   let(:perform)   { { 'notification.webhook' => { 'webhook_id' => webhook.id.to_s } } }
   let(:trigger)   { create(:trigger, activator: 'action', condition: condition, perform: perform) }

+ 1 - 1
spec/support/vcr.rb

@@ -2,7 +2,7 @@
 
 require 'vcr'
 
-VCR_IGNORE_MATCHING_HOSTS = %w[build elasticsearch selenium ci-service- zammad.org zammad.com znuny.com google.com login.microsoftonline.com 2btx5w.webhook.office.com github.com badssl.com].freeze
+VCR_IGNORE_MATCHING_HOSTS = %w[build elasticsearch selenium ci-service- zammad.org zammad.com znuny.com google.com login.microsoftonline.com github.com badssl.com].freeze
 VCR_IGNORE_MATCHING_REGEXPS = [
   %r{^192\.168\.\d+\.\d+$},   # typical home network address
   %r{^172\.17\.0\.\d+$},      # docker

+ 79 - 0
test/data/vcr_cassettes/models/webhook/pre_defined/microsoft_teams/webhook_ms_teams_with_ticket_create_as_condition_creates_a_message_in_the_ms_teams_channel.yml

@@ -0,0 +1,79 @@
+---
+http_interactions:
+- request:
+    method: post
+    uri: "<MS_TEAMS_CI_WEBHOOK_URL>"
+    body:
+      encoding: UTF-8
+      string: '{"@type":"MessageCard","@context":"http://schema.org/extensions","themeColor":"#faab00","title":"MS
+        Teams Webhook Test","text":"Created by - at 11/23/2023  6:04 am (UTC)","sections":[{"text":"*
+        Group: Users\n* Owner: -\n* State: new"},{"text":""}],"potentialAction":[{"targets":[{"os":"default","uri":"http://zammad.example.com/#ticket/zoom/5"}],"@type":"OpenUri","name":"Ticket#66002"}]}'
+    headers:
+      Accept-Encoding:
+      - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+      Accept:
+      - "*/*"
+      User-Agent:
+      - Zammad User Agent
+      Host:
+      - 2btx5w.webhook.office.com
+      X-Zammad-Trigger:
+      - Test trigger 1
+      X-Zammad-Delivery:
+      - 169b37e6-4ca8-4e4c-9e84-cc8040a9ce85
+      Content-Type:
+      - application/json; charset=utf-8
+  response:
+    status:
+      code: 200
+      message: OK
+    headers:
+      Content-Length:
+      - '1'
+      Content-Type:
+      - text/plain; charset=utf-8
+      Server:
+      - Microsoft-HTTPAPI/2.0
+      X-Beserver:
+      - AS8P190MB1912
+      X-Nanoproxy:
+      - '1,1'
+      Request-Id:
+      - 4a682049-32ba-c8e2-e119-87e24e405bcc
+      X-Calculatedfetarget:
+      - AM6PR10CU001.internal.outlook.com
+      Alt-Svc:
+      - h3=":443",h3-29=":443"
+      Ms-Cv:
+      - SSBoSroy4sjhGYfiTkBbzA.1.1
+      X-Backendhttpstatus:
+      - '200,200'
+      X-Bepartition:
+      - CLEURP190DHR01
+      X-Besku:
+      - Unknown
+      X-Calculatedbetarget:
+      - AS8P190MB1912.EURP190.PROD.OUTLOOK.COM
+      X-End2endlatencyms:
+      - '804'
+      X-Feefzinfo:
+      - DHR
+      X-Feproxyinfo:
+      - AM6PR10CA0017
+      X-Feserver:
+      - FR4P281CA0272
+      X-Proxy-Backendserverstatus:
+      - '200'
+      X-Proxy-Routingcorrectness:
+      - '1'
+      X-Firsthopcafeefz:
+      - FRA
+      Strict-Transport-Security:
+      - max-age=31536000; includeSubDomains
+      Date:
+      - Thu, 23 Nov 2023 06:04:14 GMT
+    body:
+      encoding: UTF-8
+      string: '1'
+  recorded_at: Thu, 23 Nov 2023 06:04:15 GMT
+recorded_with: VCR 6.2.0