Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use DevOps pipeline for dialing test

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to use the DevOps assembly line for dial-up testing. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

1. Why to dial-test for some key services in the system, we usually configure monitoring services. When a fault occurs, it can be detected as soon as possible and send a notification to the follower. When the fault occurs, the fault process can be traced back effectively. Dialing test is an important part of the monitoring system, which can detect the network quality of service and provide real-time alarm. On the public cloud, cloud vendors provide dialing testing services through widely distributed automated testing nodes. KubeSphere is an application-centric open source container platform, so how to implement the test function on KubeSphere? Here, the DevOps pipeline in KubeSphere is mainly used to realize the dialing test function. two。 The main pipelining features used for dialing testing with DevOps include: email notification new pipeline timing construction 2.1.The email notification of DevOps in email notification KubeSphere is different from the notification module and needs to be configured separately. You can refer to the documentation, Jenkins system settings. Here, I use the independent domain name mail service built by Poste. The following figure is the configuration page. The variable at the beginning of EMAIL_ is the mail-related configuration. If you cannot confirm the relevant parameters, you can first go to the Jenkins system configuration page to debug the parameters. 2.2 the dialed test here in a new pipeline is mainly divided into two parts: service status code and response time, which are respectively composed of two parallel Stage. The principle of the test is that the status code and response time of the service link are obtained through the curl command, and then compared with the expected value. If the trigger condition is met, an exception notification message is sent. Here are the contents of the Jenkinsfile file: pipeline {

Agent any

Parameters {

String (name: 'LINK', defaultValue:' https://kubesphere.io/', description: 'link to be dialed for test')

String (name: 'HTTP_CODE', defaultValue:' 200 codes, description: 'expected status code')

String (name: 'TIME_TOTAL', defaultValue:' 1percent, description: 'timeout, in seconds')

String (name: 'EMAIL', defaultValue:' kubesphere@mail.xxxx.com', description: 'email notifies the person when an exception occurs')

}

Stages {

Stage ('default') {

Parallel {

Stage ('status testing') {

Steps {

Script {

Try {

Sh''

Export _ HTTP_CODE=$ (curl-- connect-timeout 120s-o / dev/null-w\'% {http_code}\'$LINK)

If ["$_ HTTP_CODE" > then

Exit-1

Fi

''

} catch (err) {

CurrentBuild.result = 'FAILURE'

Mail (subject: "$LINK access status code error", body: "the message comes from the DevOps pipeline, please check whether the relevant service is abnormal." , to: "$EMAIL")

}

}

}

}

Stage ('timeout test') {

Steps {

Script {

Try {

Sh''

_ TIME_TOTAL=$ (curl-- connect-timeout 120s-o / dev/null-w\'% {time_total}\'$LINK)

TIME_TOTAL= `echo $TIME_TOTAL | awk'{print int ($0)}'`

_ TIME_TOTAL= `echo $_ TIME_TOTAL | awk'{print int ($0)}'`

If [$_ TIME_TOTAL-ge $TIME_TOTAL]

Then

Exit-1

Fi

''

} catch (err) {

CurrentBuild.result = 'FAILURE'

Mail (subject: "$LINK access timeout", body: "the message comes from the DevOps pipeline, please check whether the relevant service is abnormal." , to: "$EMAIL")

}

}

}

}

}

}

}

} 2.3 after a timed build successfully creates a dialing test pipeline, it can only be triggered manually. What is needed for dialing testing is 24-hour uninterrupted monitoring. At this point, you need to use the timed build feature of DevOps. On the pipeline page, select "more actions"-> "Edit configuration"-> Scroll Page-> "build trigger". Check timing build, set the pipeline to be triggered every 5 minutes, and enter parameters:

* / 5 * finally, click "OK" and save it. 3. Start dialing and testing your service 3.1 SUCCESS in the pipeline, directly using the expected parameters for testing.

After the execution is completed, you can see the execution status in * * activity * *-> * * status Operation * *: 3.2 FAILURE. Here, we deliberately set the status code to 201 and the timeout period to 0 seconds to trigger the notification logic.

Check the execution status: the above is the editor's share of how to use the DevOps pipeline for dialing and testing. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report