***/docs/open-api.html
② Nacos Eureka Sync 测试
- 交叉注册
- 压力测试
![掌门教育微服务体系Solar第3弹:Nacos企业级落地下篇](http://img.jiangsulong.com/240610/22243315S-9.png)
文章插图
- 有无损调用
- 自动创建同步
![掌门教育微服务体系Solar第3弹:Nacos企业级落地下篇](http://img.jiangsulong.com/240610/2224332535-10.png)
文章插图
- 减少 Sync Server
- 增加 Sync Server
![掌门教育微服务体系Solar第3弹:Nacos企业级落地下篇](http://img.jiangsulong.com/240610/2224334626-11.png)
文章插图
- 重启 Sync Server
③ Nacos Client 功能测试
Nacos Client 界面重点测试集群管理,服务列表和权限控制 。
- Nacos Server 重启后,集群管理界面正常展示3台集群节点 IP。
- 服务注册 Nacos Server 后,服务列表新增注册上去的服务名和实例个数,而且可查看详情 。
![掌门教育微服务体系Solar第3弹:Nacos企业级落地下篇](http://img.jiangsulong.com/240610/2224333B0-12.png)
文章插图
- 服务上下线操作 , 健康状态和元数据等展示正常 。
- 编辑,删除等操作只有具备 Admin 权限的人员才可操作 。
- 自动化测试链路
API网关 -> 服务A(两个实例) -> 服务B(两个实例)
![掌门教育微服务体系Solar第3弹:Nacos企业级落地下篇](http://img.jiangsulong.com/240610/2224334336-13.png)
文章插图
全链路服务部署
![掌门教育微服务体系Solar第3弹:Nacos企业级落地下篇](http://img.jiangsulong.com/240610/222433G13-14.jpg)
文章插图
- 自动化测试入口
@RunWith(SpringRunner.class)@SpringBootTest(classes = { TestApplication.class, MyTestConfiguration.class }, webEnvirOnment= SpringBootTest.WebEnvironment.RANDOM_PORT)public class MyTest { @Autowired private MyTestCases myTestCases; private static long startTime; @BeforeClass public static void beforeTest() { startTime = System.currentTimeMillis(); } @AfterClass public static void afterTest() { LOG.info("* Finished automation test in {} seconds", (System.currentTimeMillis() - startTime) / 1000); } @Test public void testNoGray() throws Exception { myTestCases.testNoGray(gatewayTestUrl); myTestCases.testNoGray(zuulTestUrl); } @Test public void testVersionStrategyGray() throws Exception { myTestCases.testVersionStrategyGray1(gatewayGroup, gatewayServiceId, gatewayTestUrl); myTestCases.testVersionStrategyGray1(zuulGroup, zuulServiceId, zuulTestUrl); }}
@Configurationpublic class MyTestConfiguration { @Bean public MyTestCases myTestCases() { return new MyTestCases(); }}
- 基于 Nacos Client 的普通调用自动化测试
@Target({ ElementType.METHOD, ElementType.TYPE })@Retention(RetentionPolicy.RUNTIME)@Inherited@Documentedpublic @interface DTest {}
代码如下:public class MyTestCases { @Autowired private TestRestTemplate testRestTemplate; @DTest public void testNoGray(String testUrl) { int noRepeatCount = 0; List<String> resultList = new ArrayList<String>(); for (int i = 0; i < 4; i++) { String result = testRestTemplate.getForEntity(testUrl, String.class).getBody(); LOG.info("Result{} : {}", i + 1, result); if (!resultList.contains(result)) { noRepeatCount++; } resultList.add(result); } Assert.assertEquals(noRepeatCount, 4); }}
- 基于 Nacos Client 的灰度蓝绿调用自动化测试
推荐阅读
- 微信怎么修改手机号
- 微信账单可以删除,怎么删除微信支付明细账单记录
- 心理咨询师有什么条件吗 报考要求有哪些_有途教育 心理咨询师有什么条件
- 微信号冻结了还能登上
- 微信语音播放失败怎么办,微信语音为什么播放不出来
- 微信怎么快速查聊天记录
- 微博主页栏怎么取消,微博怎么关闭自动续费
- 一个身份证能实名几个微信
- 微星b760m迫击炮max wifi d5主板评测
- 怎么加滴滴专车微信群