thegreenwebfoundation / greencheck-api

The green web foundation API
https://www.thegreenwebfoundation.org/
Apache License 2.0
9 stars 3 forks source link

Use symfony cache contracts instead of our own implementation #15

Closed arendjantetteroo closed 5 years ago

arendjantetteroo commented 5 years ago

This no longer allows disabling the cache, so removed those tests. Changed bliin.com to nu.nl as the first one no longer exists.

I've changed all tests to extend from a global SitecheckTestCase so they are all initialised the same way and we only need to change something once.

Tests use an array adapter now, so they don't need so much setup. Each adapter is tested by symfony so no need for us to redo that testing.

Todo:

mrchrisadams commented 5 years ago

Thanks for the @arendjantetteroo these tests are much easier to read now 👍

I've been able to recreate the error you refer to locally, and it looks like Predis isn't connecting to the specified host, so I'm looking into this, and I'm hoping to push a fix once I've worked out where to set the hostname for connections.

1) SitecheckHashCachingTest::testRunningCheckAddsToDomainCache
Predis\Connection\ConnectionException: Connection refused [tcp://127.0.0.1:6379]

/app/vendor/predis/predis/src/Connection/AbstractConnection.php:155
/app/vendor/predis/predis/src/Connection/StreamConnection.php:128
/app/vendor/predis/predis/src/Connection/StreamConnection.php:178
/app/vendor/predis/predis/src/Connection/StreamConnection.php:100
/app/vendor/predis/predis/src/Connection/AbstractConnection.php:81
/app/vendor/predis/predis/src/Connection/StreamConnection.php:258
/app/vendor/predis/predis/src/Connection/AbstractConnection.php:180
/app/vendor/predis/predis/src/Connection/StreamConnection.php:288
/app/vendor/predis/predis/src/Connection/StreamConnection.php:394
/app/vendor/predis/predis/src/Connection/AbstractConnection.php:110
/app/vendor/predis/predis/src/Client.php:331
/app/vendor/predis/predis/src/Client.php:314
/app/src/Sitecheck/Logger.php:98
/app/src/Sitecheck.php:352
/app/src/Sitecheck.php:273
/app/vendor/symfony/cache/Adapter/ArrayAdapter.php:62
/app/src/Sitecheck.php:276
/app/tests/SitecheckHashCacheTest.php:25
mrchrisadams commented 5 years ago

Okay, got it.

It looks like Predis needs you to be explicit with the host value when making a client.

We have a happy green build now 👍