天蓝色在ps中的色值

Azure Event Grid is a server-less message router. It provides a place for event publishers to send messages to (a topic), and pushes events to interested subscribers (via subscriptions). The question addressed here is: How do we write integration tests for this pub-sub mechanism?

Azure Event Grid是无服务器消息路由器。 它为事件发布者提供了向(主题)发送消息的场所,并(通过订阅)将事件推送给感兴趣的订阅者。 此处解决的问题是:我们如何为此pub-sub机制编写集成测试?

我们正在测试什么? (What are we testing?)

Integration tests should provide you with confidence your setup is working, preferably run on each change as part of a CI/CD pipeline.

集成测试应该使您充满信心,设置可以正常运行,最好在CI / CD管道的每个更改中运行。

To me, a valuable test would be to ensure we can send an event to Event Grid, and then observe it coming out the other side, to be processed by a subscriber. There are few reasons you may want to do this:

对我而言,一项有价值的测试将是确保我们可以将事件发送到事件网格,然后观察它从另一端发出并由订户处理。 您可能有几个理由要这样做:

  • You want to check that you are setting up your infrastructure correctly您要检查是否正确设置了基础架构
  • You can verify the integrity of the event on the subscriber side您可以在订户端验证事件的完整性

问题(The problem)

Posting an event to a topic boils down to making a HTTP request to the endpoint exposed by the topic. I think this is a solved problem so I won’t cover the details here.

将事件发布到主题归结为对主题公开的端点发出HTTP请求。 我认为这是一个已解决的问题,因此在此不再赘述。

However, when setting up a subscription to a topic you must provide a webhook endpoint. In production, this is going to be a genuine API that you can’t really just spam when executing integration tests. Of course you could set up your own API and have it execute your test code but that’s a faff, right?

但是,设置主题订阅时,必须提供一个Webhook端点。 在生产中,这将是一个真正的API,您在执行集成测试时不能真的只是垃圾邮件。 当然,您可以设置自己的API并让其执行您的测试代码,但这很麻烦,对吗?

Wouldn’t it be great if we could just set up a subscription and then just “listen” to events being delivered to it? This way we wouldn’t have to set up a genuine API — we would have access to the events by opening up some sort of channel. This where Azure Relay Hybrid Connections provide welcome help.

如果我们可以先设置一个订阅然后仅“监听”传递给它的事件,那不是很好吗? 这样,我们就不必建立一个真正的API -我们可以通过打开某种渠道来访问事件。 Azure Relay混合连接在此提供欢迎的帮助。

解决方案的关键 (The key to the solution)

Azure Relay allows you to expose a public endpoint in your application without having to open up any ports on your side. Clients can simply communicate with Azure Relay which will relay, hence the name, all requests to your application.

Azure Relay允许您在应用程序中公开公共终结点,而无需在自己的侧面打开任何端口。 客户端可以简单地与Azure中继进行通信,该中继将中继所有对您应用程序的请求,因此名称也是如此。

实作 (Implementation)

Before writing code, we need to actually create the required Azure resources. I’d recommend creating specific resources just for testing purposes. Might seem like a faff that your tests might have to setup up infrastructure just to execute a test but this is no different to having to setup a database just for integration tests, for example.

在编写代码之前,我们需要实际创建所需的Azure资源。 我建议创建仅用于测试目的的特定资源。 您的测试可能似乎很麻烦,您的测试可能必须仅设置基础结构才能执行测试,但这与仅针对集成测试而设置数据库没有什么不同。

建立 (Setup)

We will need:

我们会需要:

  • A Relay, with a Hybrid Connection — see the docs for creating one. It is simple enough via the Portal UI.

    具有混合连接的中继-请参阅有关创建中继的文档。 通过门户网站UI足够简单。

  • A Topic to send events to — again, can be done easily enough in the Portal UI. You will need to specify the event schema, which will dictate the shape of the events you send/receive.

    同样,可以在Portal UI中轻松完成将事件发送到的主题。 您将需要指定事件架构,该架构将决定您发送/接收的事件的形状。

  • A Subscription, on that topic, that uses the above Hybrid Connection URL as the endpoint. Via the Portal UI navigate to the Topic you just created, add a subscription. You will get the option when specifying the endpoint to select our Hybrid Connection.

    关于该主题的订阅,使用上面的混合连接URL作为端点。 通过门户网站UI导航到您刚刚创建的主题,添加订阅。 当指定端点以选择我们的混合连接时,您将获得该选项。

This can all be done manually in the UI, or can be automated via something like terraform or the Azure CLI.

这些都可以在UI中手动完成,也可以通过terraform或Azure CLI等自动化。

编写测试 (Writing the test)

If you are using C#, Microsoft provides a client that allows you to open up a connection to the Relay. Once this channel is opened up, it will receive any traffic that comes through (i.e. our events!), which we can then execute some code against. This is really the final piece, giving us the entry point into receiving events and asserting against them, without the overhead of creating a separate API.

如果您使用的是C#,Microsoft提供了一个客户端,您可以通过该客户端打开与中继的连接。 打开此通道后,它将接收通过的所有流量(即,我们的事件!),然后我们可以针对该流量执行一些代码。 这确实是最后一步,它为我们提供了接收事件并对其进行断言的切入点,而无需创建单独的API。

Roughly, the code could do something like this:

大致而言,代码可以执行以下操作:

  • Open a connection to the Relay, and start listening

    打开与中继的连接,然后开始收听

  • Post event to the Topic将活动发布到主题
  • Use the connection to observe the incoming event(s), and execute any assertions.

    使用该连接来观察传入的事件,并执行所有断言。

Posting to the topic involves making a HTTP request to the Event Grid Topic endpoint. If you are using C#, you can achieve this easily using the HttpClient class.

发布到主题涉及向事件网格主题端点发出HTTP请求。 如果使用的是C#,则可以使用HttpClient类轻松实现此目的。

For more information on how to interact with the Microsoft.Azure.Relay package, see this article.

有关如何与Microsoft.Azure.Relay包进行交互的更多信息,请参见本文。

翻译自: https://medium.com/@mikerogers1357/azure-event-grid-integration-testing-b59eae664661

天蓝色在ps中的色值


http://www.taodudu.cc/news/show-4040862.html

相关文章:

  • MQTT网关是什么?
  • 通俗易懂的讲解 网关是什么
  • 工业物联网网关是什么?工业物联网网关有什么作用?
  • 视频网关是什么,视频接入网关技术作用
  • 网关 是什么
  • java网关详解_一篇让你彻底理解网关是什么的文章
  • 网关是什么?工业网关是什么?
  • 5G智能网关是什么
  • 网关是什么
  • 【IT互联网系列】什么是网关?网关的作用是什么?看完不懂,你捶我
  • chrome自动代理检测(这玩意并没什么用,还会影响你访问某些网页)
  • 如何关闭IE浏览器安全设置检查功能
  • EndNote设置自动导入文献
  • vs code语言模式自动检测设置
  • ecplise 设置代码自动提示功能
  • 自动光学检测(AOI)
  • Unity移动端自动翻转及横竖屏的设置与检测
  • 用于自动驾驶的实时联合目标检测和语义分割网络
  • Elasticsearch关闭自动日期检测
  • 自动驾驶 Apollo 源码分析系列,感知篇(三):红绿灯检测和识别
  • Elasticsearch关闭index的自动日期检测
  • 自动驾驶-YOLOV5目标检测
  • Canny 边缘检测设置自动阈值
  • 关于网页加载慢的一个解决方法——取消勾选【局域网设置】中的【自动检测设置】
  • Python---excel筛选
  • 如何在 Excel 中筛选数据透视表中的数据?
  • UiPath Excel 数据筛选修改
  • excel高级筛选怎么用_Excel高级筛选使用
  • 怎样在表格中选出同一类_怎样在excel中筛选出带同样文字的
  • excel筛选中文或者筛选数字

天蓝色在ps中的色值_天蓝色事件网格集成测试相关推荐

  1. 天蓝色在ps中的色值_天蓝色AI服务在游戏世界中的作用

    天蓝色在ps中的色值 Welcome Back Readers, 欢迎读者, 介绍 (Introduction) I am Dhruv Trehan, Microsoft Student Partne ...

  2. 天蓝色在ps中的色值_天蓝色云上的机器学习

    天蓝色在ps中的色值 Data Science & Azure Machine Learning Service - An introduction 数据科学和Azure机器学习服务-简介 B ...

  3. 天蓝色在ps中的色值_天蓝色的cosmosdb文档中的字段级加密

    天蓝色在ps中的色值 In today's world customer's data security and privacy is of utmost importance. This becom ...

  4. 天蓝色在ps中的色值_天蓝色devsecops管道Web配置

    天蓝色在ps中的色值 Content Security Policies & The Occasional Silent Failure 内容安全策略和偶发的静默故障 The Preface ...

  5. 天蓝色在ps中的色值_用天蓝色构建混合云

    天蓝色在ps中的色值 In this day and age who would bother developing solutions on anything but the public clou ...

  6. 天蓝色在ps中的色值_加强天蓝色政策

    天蓝色在ps中的色值 The goal was clear; risk-based metrics providing a defense-in-depth based view of securit ...

  7. 高精度矢量汉字的一种填充方法_使用PS中的钢笔工具制作一只蝴蝶矢量插画

    使用PS中的钢笔工具制作一只蝴蝶矢量插画 矢量插画用途广泛,很漂亮.但是对于很多艺术家来说,创建起来太数字化而且不直观. 然而,Photoshop 的最新版本CC就解决了你在使用钢笔工具添加新变量碰到 ...

  8. 背景图层和普通图层的区别_新手如何在PS中创建图层?不容错过的7种方法,你值得学习...

    昨天跟小波一起认识了PS图层的童鞋应该已经对它不陌生了,那么在了解之后就要来实践操作,毕竟实践出真知嘛.那这一章就一起来学习在PS中创建图层吧. 在PS中,图层的创建方法有很多种,包括在"图 ...

  9. 中如何将方形图片转换成圆形图片_【PS】PS中不可不知的实用技巧!你都掌握了吗?...

    今天给大家分享一些在PS中经常用到的实用小技巧,操作简单易上手. 01 拉伸图片人物不变形 在我们在PS里想要拉伸一些图片时,里面的人物往往会跟着一起变形,那么如何改变图片比例的同时,又不影响人物的形 ...

  10. ps快捷图标在哪个文件夹_在PS中制作一个下载文件夹的图标

    在PS中制作一个下载文件夹的图标 出处:多特软件站  时间:2011-03-17  人气:1287我要提问我来说两句 核心提示:在这个教程里,我们将介绍到如何在PS中运用不同的形状和反射制作一个下载文 ...

最新文章

  1. 腾讯云工业互联网助力平台发布 推动制造业“数字化”蝶变
  2. 自定义Seekbar拖动条式样
  3. javascript写滑动图片
  4. python将数字转为0010_用Python将HTML转为PDF。
  5. Codeforces Round #701 (Div. 2)赛后补题报告(A~D)
  6. Qt文档阅读笔记-Fortune Client Example实例解析
  7. 漳州java,漳州学java,漳州学java学校,漳州学java效果怎么样
  8. 【ccpc网络赛】YJJ's Salesman【1010】【树状数组+离散化+dp】
  9. 禁止浏览器记录 文本框之前输入过的内容
  10. 初识 Hbase 数据库
  11. java自己写一个消息队列_Java语言快速实现简单MQ消息队列服务
  12. 公路自行车入门级推荐java_开学季:9款值得买公路车推荐
  13. 七、VUE基础——悦听音乐播放器案例(vue+axios)
  14. 一文带你了解redux的工作流程——action/reducer/store
  15. 企业微信周末加班怎么打卡?
  16. CAD教程:如何批量生成CAD填充边界?
  17. 20190227最近比较纠结的问题vue的video中视频的播放和nginx-rtmp的推流以及什么时候推流的分析
  18. 芯片在计算机中作用是什么,芯片的主要作用
  19. windows已经阻止此软件因为无法验证发行者,然后就是IE的控件iNetOffice5.CAB不能安装?
  20. linuxCPU负载类比知识

热门文章

  1. 算法刷题 -- 237 删除链表中的节点 <难度 ★☆☆>
  2. 相机技术--摄像机720p、1080p、2mp、3mp、5mp;VGA, QHD, FHD, 2K,4K对应的分辨率分别是什么
  3. Prumo、bp和西门子与SPIC就巴西能源项目达成合作伙伴关系
  4. 关于爬取豆瓣电影和豆瓣书本的图片
  5. c语言数学函数指数,C语言数学函数参考表
  6. for循环下标 shell_Shell数组操作 带下标遍历
  7. 网络间谍:你的共享文件夹网络监视器
  8. 全国大学生信息安全竞赛writeup--暗号(reverse300)
  9. 法语语法学习笔记——代词(1)
  10. vue 使用组件显示农历日期