diff --git a/tests/unit/test_pool.py b/tests/unit/test_pool.py index ea1b37bd9f..ee5cb766bf 100644 --- a/tests/unit/test_pool.py +++ b/tests/unit/test_pool.py @@ -214,6 +214,7 @@ def test_get_non_expired(self): self.assertFalse(pool._sessions.full()) def test_spans_bind_get(self): + # This tests retrieving 1 out of 4 sessions from the session pool. pool = self._make_one(size=4) database = _Database("name") SESSIONS = sorted([_Session(database) for i in range(0, 4)]) @@ -243,6 +244,7 @@ def test_spans_bind_get(self): self.assertSpanEvents("pool.Get", wantEventNames) def test_spans_bind_get_empty_pool(self): + # Tests trying to invoke pool.get() from an empty pool. pool = self._make_one(size=0) database = _Database("name") session1 = _Session(database) @@ -270,6 +272,8 @@ def test_spans_bind_get_empty_pool(self): ) def test_spans_pool_bind(self): + # Tests the exception generated from invoking pool.bind when + # you have an empty pool. pool = self._make_one(size=1) database = _Database("name") SESSIONS = [] @@ -458,7 +462,7 @@ def test_spans_get_empty_pool(self): wantEventNames = [ "Acquiring session", "Waiting for a session to become available", - "No sessions available. Creating session", + "No sessions available in pool. Creating session", ] self.assertSpanEvents("pool.Get", wantEventNames) @@ -477,6 +481,8 @@ def test_get_non_empty_session_exists(self): self.assertTrue(pool._sessions.empty()) def test_spans_get_non_empty_session_exists(self): + # Tests the spans produces when you invoke pool.bind + # and then insert a session into the pool. pool = self._make_one() database = _Database("name") previous = _Session(database) @@ -526,6 +532,7 @@ def test_put_empty(self): self.assertFalse(pool._sessions.empty()) def test_spans_put_empty(self): + # Tests the spans produced when you put sessions into an empty pool. pool = self._make_one() database = _Database("name") pool.bind(database) @@ -555,6 +562,8 @@ def test_put_full(self): self.assertIs(pool.get(), older) def test_spans_put_full(self): + # This scenario tests the spans produced from putting an older + # session into a pool that is already full. pool = self._make_one(target_size=1) database = _Database("name") pool.bind(database) @@ -867,7 +876,9 @@ def test_ping_oldest_stale_and_not_exists(self): SESSIONS[1].create.assert_called() self.assertNoSpans() - def test_spans_get_empty_pool(self): + def test_spans_get_and_leave_empty_pool(self): + # This scenario tests the spans generated from pulling a span + # out the pool and leaving it empty. pool = self._make_one() database = _Database("name") session1 = _Session(database)