Skip to content

Commit

Permalink
Merge branch 'main' into prototype_grpc_dp_removal
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyn authored Aug 28, 2024
2 parents 34a5214 + 7e4fbc5 commit 1e8b47c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
5 changes: 5 additions & 0 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package auth provides utilities for managing Google Cloud credentials,
// including functionality for creating, caching, and refreshing OAuth2 tokens.
// It offers customizable options for different OAuth2 flows, such as 2-legged
// (2LO) and 3-legged (3LO) OAuth, along with support for PKCE and automatic
// token management.
package auth

import (
Expand Down
6 changes: 6 additions & 0 deletions auth/credentials/idtoken/idtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package idtoken provides functionality for generating and validating ID
// tokens, with configurable options for audience, custom claims, and token
// formats.
//
// For more information on ID tokens, see
// https://cloud.google.com/docs/authentication/token-types#id.
package idtoken

import (
Expand Down
2 changes: 2 additions & 0 deletions auth/grpctransport/grpctransport.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package grpctransport provides functionality for managing gRPC client
// connections to Google Cloud services.
package grpctransport

import (
Expand Down
2 changes: 2 additions & 0 deletions auth/httptransport/httptransport.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package httptransport provides functionality for managing HTTP client
// connections to Google Cloud services.
package httptransport

import (
Expand Down
7 changes: 5 additions & 2 deletions bigtable/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,10 @@ func (t *Table) readRows(ctx context.Context, arg RowSet, f func(Row) bool, mt *
// Ignore error since header is only being used to record builtin metrics
// Failure to record metrics should not fail the operation
*headerMD, _ = stream.Header()
res := new(btpb.ReadRowsResponse)
for {
res, err := stream.Recv()
proto.Reset(res)
err := stream.RecvMsg(res)
if err == io.EOF {
*trailerMD = stream.Trailer()
break
Expand Down Expand Up @@ -438,7 +440,8 @@ func (t *Table) readRows(ctx context.Context, arg RowSet, f func(Row) bool, mt *
// Cancel and drain stream.
cancel()
for {
if _, err := stream.Recv(); err != nil {
proto.Reset(res)
if err := stream.RecvMsg(res); err != nil {
*trailerMD = stream.Trailer()
// The stream has ended. We don't return an error
// because the caller has intentionally interrupted the scan.
Expand Down
5 changes: 1 addition & 4 deletions bigtable/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,7 @@ func TestIntegration_Aggregates(t *testing.T) {
t.Fatalf("Read row mismatch.\n got %#v\nwant %#v", row, wantRow)
}

err = ac.UpdateFamily(ctx, tableName, family, Family{ValueType: AggregateType{
Input: Int64Type{},
Aggregator: MinAggregator{},
}})
err = ac.UpdateFamily(ctx, tableName, family, Family{ValueType: Int64Type{}})
if err == nil {
t.Fatalf("Expected UpdateFamily to fail, but it didn't")
}
Expand Down
22 changes: 11 additions & 11 deletions firestore/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2521,7 +2521,7 @@ func TestIntegration_AggregationQueries(t *testing.T) {

indexFields := [][]string{
{"weight", "model"},
{"weight", "height"},
{"weight", "volume"},
}
adminCtx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
defer cancel()
Expand All @@ -2530,14 +2530,14 @@ func TestIntegration_AggregationQueries(t *testing.T) {

h := testHelper{t}
docs := []map[string]interface{}{
{"weight": 1.5, "height": 99, "model": "A"},
{"weight": 2.6, "height": 98, "model": "A"},
{"weight": 3.7, "height": 97, "model": "B"},
{"weight": 4.8, "height": 96, "model": "B"},
{"weight": 5.9, "height": 95, "model": "C"},
{"weight": 6.0, "height": 94, "model": "B"},
{"weight": 7.1, "height": 93, "model": "C"},
{"weight": 8.2, "height": 93, "model": "A"},
{"weight": 1.5, "volume": 99, "model": "A"},
{"weight": 2.6, "volume": 98, "model": "A"},
{"weight": 3.7, "volume": 97, "model": "B"},
{"weight": 4.8, "volume": 96, "model": "B"},
{"weight": 5.9, "volume": 95, "model": "C"},
{"weight": 6.0, "volume": 94, "model": "B"},
{"weight": 7.1, "volume": 93, "model": "C"},
{"weight": 8.2, "volume": 93, "model": "A"},
}
docRefs := []*DocumentRef{}
for _, doc := range docs {
Expand Down Expand Up @@ -2572,7 +2572,7 @@ func TestIntegration_AggregationQueries(t *testing.T) {
}{
{
desc: "Multiple aggregations",
aggregationQuery: query.NewAggregationQuery().WithCount("count1").WithAvg("weight", "weight_avg1").WithAvg("height", "height_avg1").WithSum("weight", "weight_sum1").WithSum("height", "height_sum1"),
aggregationQuery: query.NewAggregationQuery().WithCount("count1").WithAvg("weight", "weight_avg1").WithAvg("volume", "height_avg1").WithSum("weight", "weight_sum1").WithSum("volume", "height_sum1"),
wantErr: false,
result: map[string]interface{}{
"count1": &pb.Value{ValueType: &pb.Value_IntegerValue{IntegerValue: int64(8)}},
Expand All @@ -2584,7 +2584,7 @@ func TestIntegration_AggregationQueries(t *testing.T) {
},
{
desc: "Aggregations in transaction",
aggregationQuery: query.NewAggregationQuery().WithCount("count1").WithAvg("weight", "weight_avg1").WithAvg("height", "height_avg1").WithSum("weight", "weight_sum1").WithSum("height", "height_sum1"),
aggregationQuery: query.NewAggregationQuery().WithCount("count1").WithAvg("weight", "weight_avg1").WithAvg("volume", "height_avg1").WithSum("weight", "weight_sum1").WithSum("volume", "height_sum1"),
wantErr: false,
runInTransaction: true,
result: map[string]interface{}{
Expand Down

0 comments on commit 1e8b47c

Please sign in to comment.