Expand test coverage for GrpcResultSet and runWithRetries()#3702
Expand test coverage for GrpcResultSet and runWithRetries()#3702pongad merged 7 commits intogoogleapis:masterfrom nithinsujir:covg3
Conversation
Signed-off-by: Nithin Nayak Sujir <nsujir@google.com>
|
R: @biswanag |
snehashah16
left a comment
There was a problem hiding this comment.
if possible, could u also add code coverage stats in these reviews..
| .build()); | ||
| consumer.onCompleted(); | ||
| resultSet.next(); | ||
| assertThat(resultSet.getBoolean(0)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| resultSet.next(); | ||
| Double d = resultSet.getDouble(0); | ||
| assertThat(d.equals(Double.MIN_VALUE)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| consumer.onCompleted(); | ||
| resultSet.next(); | ||
|
|
||
| assertThat(resultSet.getDoubleArray(0).equals(dArray)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| consumer.onCompleted(); | ||
|
|
||
| resultSet.next(); | ||
| assertThat(resultSet.getTimestamp(0) == Timestamp.parseTimestamp("0001-01-01T00:00:00Z")); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| consumer.onCompleted(); | ||
|
|
||
| resultSet.next(); | ||
| assertThat(resultSet.getDate(0).compareTo(Date.fromYearMonthDay(2018, 5, 29)) == 0); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Cool, I'll change it. Thanks.
…On Wed, Sep 19, 2018 at 2:24 PM Michael Darakananda < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
google-cloud-clients/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java
<#3702 (comment)>
:
> + }
+
+ @test
+ public void getDoubleArray() {
+ double[] dArray = {Double.MAX_VALUE, Double.MIN_VALUE, 111, 333, 444, 0, -1, -2234};
+
+ consumer.onPartialResultSet(
+ PartialResultSet.newBuilder()
+ .setMetadata(makeMetadata(Type.struct(
+ Type.StructField.of("f", Type.array(Type.float64())))))
+ .addValues(Value.float64Array(dArray).toProto())
+ .build());
+ consumer.onCompleted();
+ resultSet.next();
+
+ assertThat(resultSet.getDoubleArray(0).equals(dArray));
I *think* it's fine? The Javadoc doesn't seem to think this is deprecated
https://google.github.io/truth/api/0.42/com/google/common/truth/PrimitiveDoubleArraySubject.html
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3702 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHP1lwmAqcyzOankuo5A9Pbpw2DCqlKks5ucrX-gaJpZM4WwgA4>
.
|
|
|
||
| resultSet.next(); | ||
| Double d = resultSet.getDouble(0); | ||
| assertThat(d.equals(Double.MIN_VALUE)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| Double d = resultSet.getDouble(0); | ||
| assertThat(d.equals(Double.MIN_VALUE)); | ||
| resultSet.next(); | ||
| assertThat(resultSet.getDouble(0)).isWithin(0.0).of(Double.MAX_VALUE); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| consumer.onCompleted(); | ||
|
|
||
| resultSet.next(); | ||
| assertThat(resultSet.getDate(0) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| assertThat(row).isEqualTo(copy); | ||
| } | ||
|
|
||
| @Test |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| assertThat(row).isEqualTo(copy); | ||
| } | ||
|
|
||
| @Test |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
| }); | ||
| } catch (SpannerException e) { | ||
| assertThat(e.getErrorCode() == ErrorCode.INTERNAL); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@nithinsujir This LGTM, are we good to merge? |
|
@pongad Yes, this is good to go, thanks. |
The coverage is now at 84% for Instructions and 81% for Branches.