Repository navigation
Commit d086ba7
authored
test(spanner): unflake BuiltInMetricsCustomOpenTelemetryTest and BuiltInMetricsBothSinksTest (#14282)
In `executeSelect1()`, `resultSet.next()` was called only once for
`SELECT 1`. Closing the `ResultSet` before consuming the stream to EOF
invokes `iterator.close()`, which sends `call.cancel("ResultSet closed",
null)` to the underlying gRPC stream.
If client cancellation races ahead of the mock server's `onCompleted()`,
the stream terminates with `Status.CANCELLED`. As a result,
`SpannerTracer.operationSucceeded()` is never invoked, omitting
`Spanner.ExecuteStreamingSql` (status `OK`) from
`spanner.googleapis.com/internal/client/operation_count` and causing the
test assertion to fail.
Consume the `ResultSet` to EOF (`assertFalse(resultSet.next())`) in both
`BuiltInMetricsCustomOpenTelemetryTest` and
`BuiltInMetricsBothSinksTest` to guarantee that the stream finishes
normally before closing.1 parent 89a8268 commit d086ba7
2 files changed
Lines changed: 3 additions & 0 deletions
File tree
- java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
0 commit comments