Open ti-mo opened 3 years ago
Good point, should work well with curl that has well defined exit codes. ping
seems to differentiate between these cases as well:
$ ping -c1 -w1 1.2.3.4
PING 1.2.3.4 (1.2.3.4) 56(84) bytes of data.
--- 1.2.3.4 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
vagrant@runtime:~/go/src/github.com/cilium/cilium-cli$ echo $?
1
vagrant@runtime:~/go/src/github.com/cilium/cilium-cli$ ping -c1 -w1 foo.bar.net.com
ping: foo.bar.net.com: Name or service not known
vagrant@runtime:~/go/src/github.com/cilium/cilium-cli$ echo $?
2
Not sure how universal the ping
return codes are, however.
Maybe we should keep the test fail expectations on the current, more abstract level, and translate them to command specific exit code expectations under the hood?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Some connectivity tests (e.g. https://github.com/cilium/cilium-cli/pull/158) make
curl
fail with (expected) DNS resolution errors.We should be able to narrow down the exit codes of the underlying test programs to ensure we don't get any false negatives with regards to test outcomes. For example, it's not acceptable for a test to fail on DNS resolution when a TCP connection failure was expected.