|
14 | 14 |
|
15 | 15 | import mock |
16 | 16 | import pytest |
17 | | -import unittest |
18 | 17 |
|
19 | 18 | from . import _helpers |
20 | | -from google.cloud.spanner_v1 import Client, DirectedReadOptions |
| 19 | +from google.cloud.spanner_v1 import Client |
21 | 20 |
|
22 | 21 | HAS_OTEL_INSTALLED = False |
23 | 22 |
|
|
35 | 34 | pass |
36 | 35 |
|
37 | 36 |
|
38 | | -@pytest.mark.skipif(not HAS_OTEL_INSTALLED, reason="OpenTelemetry needed.") |
39 | | -@pytest.mark.skipif(not _helpers.USE_EMULATOR, reason="Emulator needed.") |
| 37 | +@pytest.mark.skipif( |
| 38 | + not HAS_OTEL_INSTALLED, reason="OpenTelemetry is necessary to test traces." |
| 39 | +) |
| 40 | +@pytest.mark.skipif( |
| 41 | + not _helpers.USE_EMULATOR, reason="mulator is necessary to test traces." |
| 42 | +) |
40 | 43 | def test_observability_options_propagation(): |
41 | 44 | PROJECT = _helpers.EMULATOR_PROJECT |
42 | | - PATH = "projects/%s" % (PROJECT,) |
43 | 45 | CONFIGURATION_NAME = "config-name" |
44 | 46 | INSTANCE_ID = _helpers.INSTANCE_ID |
45 | | - INSTANCE_NAME = "%s/instances/%s" % (PATH, INSTANCE_ID) |
46 | 47 | DISPLAY_NAME = "display-name" |
47 | 48 | DATABASE_ID = _helpers.unique_id("temp_db") |
48 | 49 | NODE_COUNT = 5 |
49 | | - PROCESSING_UNITS = 5000 |
50 | 50 | LABELS = {"test": "true"} |
51 | | - TIMEOUT_SECONDS = 80 |
52 | | - LEADER_OPTIONS = ["leader1", "leader2"] |
53 | | - DIRECTED_READ_OPTIONS = { |
54 | | - "include_replicas": { |
55 | | - "replica_selections": [ |
56 | | - { |
57 | | - "location": "us-west1", |
58 | | - "type_": DirectedReadOptions.ReplicaSelection.Type.READ_ONLY, |
59 | | - }, |
60 | | - ], |
61 | | - "auto_failover_disabled": True, |
62 | | - }, |
63 | | - } |
64 | 51 |
|
65 | 52 | def test_propagation(enable_extended_tracing): |
66 | 53 | global_tracer_provider = TracerProvider(sampler=ALWAYS_ON) |
@@ -95,13 +82,13 @@ def test_propagation(enable_extended_tracing): |
95 | 82 |
|
96 | 83 | try: |
97 | 84 | instance.create() |
98 | | - except: |
| 85 | + except Exception: |
99 | 86 | pass |
100 | 87 |
|
101 | 88 | db = instance.database(DATABASE_ID) |
102 | 89 | try: |
103 | 90 | db.create() |
104 | | - except: |
| 91 | + except Exception: |
105 | 92 | pass |
106 | 93 |
|
107 | 94 | assert db.observability_options == observability_options |
@@ -134,7 +121,7 @@ def test_propagation(enable_extended_tracing): |
134 | 121 | try: |
135 | 122 | db.delete() |
136 | 123 | instance.delete() |
137 | | - except: |
| 124 | + except Exception: |
138 | 125 | pass |
139 | 126 |
|
140 | 127 | # Test the respective options for enable_extended_tracing |
|
0 commit comments