|
25 | 25 | TEST_LOGGER_NAME = "example_log_{}".format(uuid.uuid4().hex) |
26 | 26 | TEST_TEXT = "Hello, world." |
27 | 27 | GOOGLE_CLOUD_PROJECT = os.getenv("GOOGLE_CLOUD_PROJECT") |
28 | | -DEFAULT_LOG_ID = f"projects/{GOOGLE_CLOUD_PROJECT}/logs/python" |
| 28 | +DEFAULT_LOGGER = f"projects/{GOOGLE_CLOUD_PROJECT}/logs/python" |
29 | 29 |
|
30 | 30 |
|
31 | 31 | @pytest.fixture |
@@ -56,18 +56,17 @@ def eventually_consistent_test(): |
56 | 56 | # retrieve logs |
57 | 57 | client = logging.Client() |
58 | 58 |
|
59 | | - log_filter = DEFAULT_LOG_ID |
| 59 | + log_filter = DEFAULT_LOGGER |
60 | 60 |
|
61 | 61 | entries = client.list_entries( |
62 | 62 | filter_=log_filter, order_by=logging.DESCENDING, max_results=3 |
63 | 63 | ) |
64 | 64 |
|
65 | | - entry_1 = next(entries) |
66 | | - assert entry_1.payload["message"] == "This is a JSON log." |
67 | | - entry_2 = next(entries) |
68 | | - assert entry_2.payload == "Goodbye, world!" |
69 | | - entry_3 = next(entries) |
70 | | - assert entry_3.payload == "Hello, world!" |
| 65 | + retrieved_entries = list(entries) |
| 66 | + |
| 67 | + assert retrieved_entries[0].payload["message"] == "This is a JSON log." |
| 68 | + assert retrieved_entries[1].payload == "Goodbye, world!" |
| 69 | + assert retrieved_entries[2].payload == "Hello, world!" |
71 | 70 |
|
72 | 71 | eventually_consistent_test() |
73 | 72 |
|
|
0 commit comments