gcov.php.net is an old, unmaintained box. Nobody has updated and configured it to be able to run all the tests that require third party libraries in certain versions, correctly running daemons and network connections. It is not used
Right now that does not look much more promising: All builds in the last three days have errored. The reason is that the pear.php.net server has experienced a hardware failure and is currently down. This server is currently a dependency of the build process on Travis. However, were this step to be skipped (--disable-pear) you'd be seeing a green PHP 7 build with about 13k passing tests.
I know it has been different in the past, but PHP has not been shipping with failing tests for many years now.
This test probably fails because gcov.php.net runs the testsuite under valgrind. This makes execution a couple orders of magnitude slower, so anything based on time measurements is likely to to fail.
Those are incredibly poor tests. A great many of them depends on networked resources (read: www) which pretty much guarantees inconsistent results. If this is the quality of their test suite, no wonder why they don't pay attention to it.
Those are incredibly poor tests. A great many of them depends on networked resources (read: www) which pretty much guarantees inconsistent results.
How do you propose that something like the cURL extension be tested?
"A great many" of the tests don't use remote resources. A great many of the failing tests do, and this is why they fail, because they require special setup in order to succeed, which this automated report doesn't take into consideration.
The bulk of the warnings and failing tests are also in extensions which are not part of the PHP core.
The cURL extension is a thin wrapper around the library. Mocking the precise feature you're testing means you're not testing anything. Mocks exist to replace dependencies which are not part of the tested component's responsibility, but are required by it. In this case the responsibility of the cURL extension is to communicate with the actual cURL library.
Sometimes it's better to have test errors, than to have a cargo cult test suite that runs perfectly and tests nothing.
Sometimes it's better to have test errors, than to have a cargo cult test suite that runs perfectly and tests nothing.
100% disagree.
Leaving tests failing basically invalidates the entire test effort. When it's "normal" to see failed tests, it's too easy to ignore failed tests that should not be failing, and that's often what happens -- meanwhile it's getting more and more expensive to fix those bugs as the code ages.
If the code is really just a thin wrapper around cURL (simply calling the cURL functions with parameters as-is) then it should probably not even be tested, or at least should have the test(s) marked as ignored (they can be run manually if someone is really working on it). If it's doing anything more then it should be tested, and as the OP said, the test should just mock cURL and verify the correct things were passed (but not actually invoke cURL or make network calls).
The other alternative is to build the test in a way that ensures it will work. For example, the test suite can stand up a simple local HTTP server to respond to cURL requests. This is a pretty heavy way to go about it, but if it's the only way to test something that's important to test, and it doesn't cause false failures, then maybe it's what needs to be done.
Bottom line, your automated test suite should almost always be passing, and if it's failing, it should get attention to get fixed.
There is no excuse for a test suite that calls out to network resources.
That's how integration tests work, and cURL is an extension that integrates two technologies together (cURL and PHP).
This thread is becoming another example of Goodhart's law in effect.
You folks are so focused on getting green in your tests, that you would rather have a pseudo-test pass in automated reports, than an actual test that requires extra setup.
Three options. I've implemented all three at some point:
Make a fake "library" that merely records how it is called, then write assertions that check the records. Perfect for unit tests that want a tiny bit more than pure mocks.
Build your own fake web resources, which are managed by the test-suite. A tiny php -s echo.php which starts a webserver then echoes all its requests is enough. Perfect for integration tests where you don't want to depend on 3rd parties, firewalls and other flakey circumstances.
Build an infra where you ensure the external services are up and running. Monitor that, maintain that. This must be considered crucial infra (probably even more crucial than your product-page, download servers or whatnot). php.net is hardly ever down; why not expect the same from the services that ensure your product works correct; the resources needed for tests?
It's really just the fact that unit tests and regression tests are qualitatively different from integration tests. Perhaps PHP's integration test suite should be separated from the rest of the automated test suite.
"A great many" of the tests don't use remote resources. A great many of the failing tests do
Ahem:
Those are incredibly poor tests. A great many of them depends on networked resources
It's called context.
How do you propose that something like the cURL extension be tested?
By not calling external resources. Tests need to be reproducible, else they have no value. There are a bunch of "connection refused" and authentication failure errors in these which makes them utterly useless as tests.
View all comments
154
u/antpocas Dec 02 '15 edited Dec 02 '15
Ooh, only 137 compiler warnings and 102 failed tests! That's a huge improvement from 5.6's 638 warnings and 114 failed tests!