Skip to content

Commit

Permalink
WIP: fix newly-failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskuehl committed Jan 16, 2024
1 parent 8c8735d commit 1482228
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
12 changes: 6 additions & 6 deletions tests/unit/clients/cassandra_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,16 @@ def test_prom__on_execute_complete(self):
prom_labels = prom_labels_tuple._asdict()
prom_labels_w_success = {**prom_labels, **{"cassandra_success": "true"}}

self.assertEquals(
self.assertEqual(
REGISTRY.get_sample_value("cassandra_client_requests_total", prom_labels_w_success), 1
)

# we start from 0 here since this is a unit test, so -1 is the expected result
self.assertEquals(
self.assertEqual(
REGISTRY.get_sample_value("cassandra_client_active_requests", prom_labels), -1
)

self.assertEquals(
self.assertEqual(
REGISTRY.get_sample_value(
"cassandra_client_latency_seconds_bucket",
{**prom_labels_w_success, **{"le": "+Inf"}},
Expand Down Expand Up @@ -313,16 +313,16 @@ def test_prom__on_execute_failed(self):
prom_labels = prom_labels_tuple._asdict()
prom_labels_w_success = {**prom_labels, **{"cassandra_success": "false"}}

self.assertEquals(
self.assertEqual(
REGISTRY.get_sample_value("cassandra_client_requests_total", prom_labels_w_success), 1
)

# we start from 0 here since this is a unit test, so -1 is the expected result
self.assertEquals(
self.assertEqual(
REGISTRY.get_sample_value("cassandra_client_active_requests", prom_labels), -1
)

self.assertEquals(
self.assertEqual(
REGISTRY.get_sample_value(
"cassandra_client_latency_seconds_bucket",
{**prom_labels_w_success, **{"le": "+Inf"}},
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/clients/sqlalchemy_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def setUp(self):

def test_url(self):
engine = engine_from_config({"database.url": "sqlite://"})
self.assertEqual(engine.url, URL("sqlite"))
self.assertEqual(engine.url, URL.create("sqlite"))

@mock.patch("baseplate.clients.sqlalchemy.create_engine")
def test_credentials(self, create_engine_mock):
Expand All @@ -47,7 +47,7 @@ def test_credentials(self, create_engine_mock):
self.secrets,
)
create_engine_mock.assert_called_once_with(
URL(
URL.create(
drivername="postgresql",
username="reddit",
password="password",
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/observers/sentry_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def sentry_transport():
@pytest.fixture(autouse=True)
def init_sentry_client(sentry_transport):
try:
init_sentry_client_from_config({"sentry.dsn": "foo"}, transport=sentry_transport)
# https://docs.sentry.io/product/sentry-basics/concepts/dsn-explainer/#the-parts-of-the-dsn
init_sentry_client_from_config(
{"sentry.dsn": "https://fakekey@fakehost/1"}, transport=sentry_transport
)
yield
finally:
sentry_sdk.init() # shut everything down
Expand Down

0 comments on commit 1482228

Please sign in to comment.