''' The purpose of these tests is to confirm that using a non-standard connection pool that does not have a `connection_kwargs` attribute will not result in an error. ''' import pytest import redis from newrelic.api.background_task import background_task from testing_support.fixtures import (validate_transaction_metrics, override_application_settings) from testing_support.db_settings import redis_settings from testing_support.util import instance_hostname DB_SETTINGS = redis_settings()[0] REDIS_PY_VERSION = redis.VERSION class FakeConnectionPool(object): """Connection Pool without connection_kwargs attribute.""" def __init__(self, connection): self.connection = connection def get_connection(self, name, *keys, **options): return self.connection def release(self, connection): self.connection.disconnect()
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pytest import aredis from newrelic.api.background_task import background_task from testing_support.fixture.event_loop import event_loop as loop from testing_support.fixtures import (validate_transaction_metrics, override_application_settings) from testing_support.db_settings import redis_settings from testing_support.util import instance_hostname DB_MULTIPLE_SETTINGS = redis_settings() # Settings _enable_instance_settings = { 'datastore_tracer.instance_reporting.enabled': True, } _disable_instance_settings = { 'datastore_tracer.instance_reporting.enabled': False, } # Metrics _base_scoped_metrics = ( ('Datastore/operation/Redis/get', 1), ('Datastore/operation/Redis/set', 1),