How to reduce the cost of microservice testing? My experience

Preface

With the advent of the cloud-native era, more and more applications are born on the cloud and grow on the cloud. Cloud-native is the best companion for enterprises to land microservices. However, the testability of cloud applications has been greatly challenged. How to improve the testability of cloud applications and enhance DevOps capabilities is the core problem to be solved in microservice testing.

Before detailing the microservice testing, let me tell you a scenario.

The above figure is a typical enterprise microservice application architecture diagram. In order to consider security, cloud applications are usually deployed in virtual local area networks on the cloud, and services are exposed to the outside through the gateway. For the student responsible for the Product Service application, I just want to test whether the service corresponding to the application is available. What will he do?

Option One

Enter the machine (ECS) or container (Pod) where the application is deployed, and verify whether the service is available through the curl command

Option II

Expose the application to public network access and verify whether the service is available through the local command line tool or Postman tool

third solution

Pull a dedicated network line to connect the VPC and office network on the cloud, and verify whether the service is available through the local command line tool or the Postman tool

From the above scenarios, we can summarize a few problems of microservice testing on the cloud:

  • Complex network topology on the cloud
  • Expose public network access, there will be hacker attacks, causing security risks
  • Pull a dedicated network line, waste resource costs

Obviously, I only want a simple test capability, but the cost is so high. The above scenario is only a simple debugging function. If it is pressure testing, automated regression, inspection and other testing and stability assurance methods, it is not only necessary to solve the problems encountered in the above scenario, but also requires self-built tools to make up for it. , All feel that the cost is too high, therefore, we need microservice testing to help us solve these problems and further accelerate the efficiency of software delivery.

Why do we need microservice testing

Product capabilities

Provide testing, stress testing, automated regression, inspection and other capabilities to form a microservice testing solution

Imagine that R&D students submit code and deploy it. Test tools can be used to verify the correctness of the service logic; stress testing tools can be used to verify service performance indicators; after the verification is passed, the smoke test can be started, and automated regression tools can be used to write Cigarette use case: After the smoke is passed, the historical function regression can be started. You can use the automated regression tool to write the regression case; after the regression is passed, the test is submitted for acceptance. The test only needs to verify the new function. After the new function is verified, it can be submitted for release. After the release, the online environment verification needs to return to the main process of the historical function. You can use the automated regression tool to write the main process return use case and the new function manual verification; the main process returns and the new function verification passes, which means the release is completed; R&D students, You can use the inspection tool to configure the online inspection; once the inspection alarms, you can find the problem before the user and solve the problem. We are the productized output of Alibaba's accumulated test solutions to help cloud businesses achieve high-quality and rapid delivery.

Easy to use and safe

Out of the box, there is no need to pay attention to the network topology under the VPC; it is safe and reliable, and has a test experience under the office network.

Imagine that for the sake of security isolation, the R&D environment, test environment, pre-release environment, and production environment are deployed in different private network VPCs. If users build test tools by themselves, they need to solve the problem of network interoperability between test tools and different environments. IT staff obviously only want a simple test tool, but because after going to the cloud, it is far from over to solve the complex network topology on the cloud. In order to be able to use the test tool on the office network, it is necessary to ensure that the test tool can be used. Office network visits are now facing the test of network security. We hope that there is a safe and reliable solution that can be used out of the box, so that enterprise IT personnel who go to the cloud have a testing tool to test the experience on the office network.

low cost

Pull up the testing machine/pressing machine flexibly and destroy it when it is used up, which can greatly reduce the machine resources and labor costs required to build the testing tool.

Imagine that enterprises go to the cloud to reduce costs. Application hosting has greatly reduced resource costs and operation and maintenance costs, but testing costs have not been reduced. Enterprise IT personnel need to prepare test machines/pressurizers for self-built test tools. These machines are occupied for a long time and are idle, and the resource cost is high. Especially in the performance stress test scenario, the resource cost will be more expensive.

In addition to resource costs, enterprise IT personnel also need to develop test tools. The labor cost and time cost are very high. Basically every company needs a set of test tools. We hope to have a low-cost solution that not only improves the resource utilization rate of the enterprise, but also reduces the cost of enterprise IT personnel to develop and maintain test tools.

Microservice ecology

A large number of microservice products have been provided on the cloud, which solves the problem of hosting, managing, and diagnosing microservice applications, as well as microservice testing to complement the microservice capabilities.

Imagine how to test a microservice interface, you need to understand the input and output parameters of the interface. If you are a R&D student-service provider, you may be familiar with the interface. If you are a testing student or even other R&D students, you may need documentation. Even word of mouth, microservice governance has visualized the service contract information of the application, combined with the service contract information, just according to the test needs, select Application -> Framework -> Service -> Method, configure the test parameters, you can test, reduce The cost of service contract synchronization.

Combining the above 4 points, test students only need to be responsible for use case writing + test acceptance. Interface debugging, interface performance level, and use case automation can all empower R&D students. Just like early DevOps, it reduces the feedback loop between R&D and operation and improves Software delivery efficiency, DevTest, reduces the feedback loop between R&D and testing. Under the premise of ensuring delivery quality, it further improves the efficiency of software delivery. At the same time, it actively creates inspection tasks and regularly monitors the availability of online services to find problems before users. Solve the problem.

MSE Microservice Testing Practice

Prerequisite: Microservice application has been connected to MSE

Let's experience how to use the capabilities of microservice testing on MSE.

Service test

1. Log in to the MSE console and select the region in the upper left corner of the page;
2. Select the left navigation bar: Microservice governance -> Microservice testing -> Service testing -> Query service;
3. Click on the details of a service -> Display the metadata list;
4. Click the test of a certain method -> enter the test page (the user has been helped to fill in the parameter template);
5. Click to execute.

Service stress test

1. Log in to the MSE console and select the region in the upper left corner of the page;
2. Select in the left navigation bar: Microservice governance -> Microservice testing -> Service stress testing -> Create scenario;
3. Select the application that needs stress testing -> Select Frame -> Select Service -> Select Method;
4. Fill in the pressure measurement parameters and click OK;
5. Enter the pressure measurement scene list page, click Details;
6. Enter the pressure measurement details page, click Start, and wait for the press to be ready ;
7, click on the details, into the pressure measured performance data reporting page, view real-time performance data;

Automated regression

1. Log in to the MSE console and select the region in the upper left corner of the page;

2. Select from the left navigation bar: Microservice governance -> Microservice testing -> Automated regression -> Create use case;

3. Add steps

Select application -> select framework -> select service -> select method; fill in parameters; assertion/out parameter extraction;
4. Multiple steps can be added;

5, storage example;

6. Click to execute;

7. Through the execution history, check whether the use case passes;

Service inspection

1. Log in to the MSE console and select the region in the upper left corner of the page;
2. Select in the left navigation bar: Microservice governance -> Microservice testing -> Service inspection -> Create inspection task;
3. Select the application that needs inspection -> Select frame -> Select service -> Select method;
4. Fill in the inspection parameters and assertion content, and click OK;
5. Enter the inspection task list page and click Start to start the inspection;
6. When the inspection fails, You can view it through the failure record, or you can add an alarm, and send an alarm by nailing, SMS, and email;

Microservice testing implementation details

Tool capability

Productized output of testing tools practiced in Alibaba Group, pressure testing, automated regression, and inspection to reduce the cost of user research and development tools.

Network interworking

Use Alibaba Cloud’s existing network to get through the technical solution (ENI mount) to get through the cloud product private network VPC and user private network VPC

When the application installs the microservice agent, it actively reports the network information (private network VPC, virtual switch VSwitch, security group SecurityGroup) where the application is located to the server. According to the network information where the application is located, the cloud product private network VPC can be opened With the user's private network VPC, the cloud product services can directly access the services deployed by the user's private network VPC.

Flexible resources

Cloud products use their own resource accounts to purchase flexible machines and install test tools

Service contract

Microservice governance has visualized service contract information, and microservice testing can directly query service contract information

More than just microservice testing

This article introduces several capabilities of microservice testing under microservice governance, and complements the capabilities of microservice ecological testing. Smart traffic testing will be launched soon: Provide traffic production recording production playback, production recording offline playback, and testing under the microservice architecture Use case automated generation, regression test scenario automated coverage and other capabilities help your application to easily complete test verification at a lower cost. Welcome to experience it.

In addition to MSE (Micro Service Engine), micro service testing capabilities will also be integrated with cloud products such as EDAS and SAE. The microservice testing capability is used as a basic capability to be integrated by more cloud products. In addition, it will be linked with more microservice products ARMS (application real-time monitoring service), ACM (application configuration management), and CSB (gateway) to help protect the cloud Improve business stability and keep business online forever.

Original link

This article is the original content of Alibaba Cloud and may not be reproduced without permission.

 

Guess you like

Origin blog.csdn.net/weixin_43970890/article/details/112600386