0
votes

VSTest unit-test's ping of a DNS server (8.8.8.8) fails when running within Azure Pipeline. The ping operation is a part of a few unit tests. When these unit tests ran on a local computer - everything works well. However, when the same unit tests are executed on Azure Pipeline CI - all the ping operations fail. What is strange all other Internet-based calls (like HTTP POSTs) are working fine locally and on the Azure Pipeline CI. Any ideas?

1
ICMP probably blocked?4c74356b41
thanks for the quick reply. is there a way to open ICMP on an Azure Pipeline vm?AKornich
You can use your own machine to host the CI agent. It is also strange that you make a "unit test case" to depend on variable factors such as an external DNS service. They are usually mocked up.Lex Li
yes, we have a few unit tests that are essentially integration tests verifying the whole processing stack in real conditions (as close as possible to production environment). this approach worked very well for us with just HTTP calls used until recently when we added some ping calls into the mix that appears to be blocked by default in Azure Pipelines.AKornich

1 Answers

0
votes

VSTest unit-test's ping of a DNS server (8.8.8.8) fails when running within Azure Pipeline

I am afraid you have to setup your private agent on your local machine.

As test, I could also ping of a DNS server (8.8.8.8) successfully on a local computer but failed on the hosted agent on Azure pipeline.

That because:

The ICMP protocol is not permitted through the Azure load balancer, you will notice that you are unable to ping an Azure VM from the internet, and from within the Azure VM, you are unable to ping internet locations.

Check the blog Use port pings instead of ICMP to test Azure VM connectivity for some more details.

Besides, we could also not through Windows Firewall allow ping on the Azure VM.

So, if you want to ping the DNS server, you need to create your private agent on you local machine:

Set Up a Private Agent

Hope this helps.