In Azure DevOps Server running on Spring Boot and Consul micro-services unit testing

1 Overview

Speaking micro-services architecture system, not open around the service discovery function. Service discovery mechanism is to simplify the configuration of micro-services, implement disaster recovery, horizontal scaling capacity, operation and maintenance to improve the efficiency of an important way. In the service discovery tool, Consul seamless deployment and use in combination with the container, becoming the product of choice for a growing number of enterprises as service discovery.
In the micro-services development, SpringBoot is currently the most widely used a framework. SpringBoot + Consul become a more classic micro-services portfolio.

As DevOps software development operation and maintenance of integrated product development management platform, provides excellent support for the above-mentioned micro-service architecture. Here we have an example of unit testing, to illustrate how to implement continuous integration SpringBoot + Consul architecture (CI) function in Azure DevOps Server (formerly known as TFS).

2. Download the Consul for Windows

https://www.consul.io/downloads.html

3. Consul installed in the proxy server automatically started

SpringBoot architecture unit testing, verification service discovery and registration function is a basis for comparison of test points. In the developer's computer, usually a consul to manually start the process to implement a local test. Also, as a tool for continuous integration server, we need to run on Azure DevOps Server server Consul service.
Here we use Windows Server sc.exe commonly used tool to create Consul service.

sc.exe create "Consul" binPath= "C:\consul_1.5.1_windows_amd64\consul.exe agent -dev" start=auto
sc.exe start "Consul"

image
image
After the service starts, we can use the browser to view the operation of the Consul of:

image

4. Configure Pipeline

Azure DevOps Server Configuration in the pipeline, only need to check the release "will publish the test results into the pipeline" on it; when the results after the completion of the pipeline, Azure DevOps Server will test result file (usually an xml file) automatically to publish the results in the pipeline.image

The test result viewing unit

After the completion of the pipeline running, we can see the tab to test the unit test results, as shown below: Also, if you download the unit test results, you can view the details of the test suite
image

image

6. Frequently Asked Questions

Consul service will not start :

The reason is that generally have to manually start the process Consul, 8500 port is occupied

IE browser to view Consul server, an error:

Built on Windows Server IE 11 can not normally access Consul, replaced by Chrome, the problem goes away

------------------------------------------------------------

http://www.cnblogs.com/danzhang/   DevOps MVP Zhang Hongjun

------------------------------------------------------------

Guess you like

Origin www.cnblogs.com/danzhang/p/11913673.html