From efbd542a4f9947d6b1392f538e3b0dd3d1c94b90 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 12 Apr 2022 15:26:47 -0700 Subject: [PATCH] gcp/observability: correctly test this module in presubmit tests (#5300) (#5307) --- .github/workflows/testing.yml | 9 ++++++--- gcp/observability/config.go | 2 +- gcp/observability/exporting.go | 2 +- gcp/observability/go.mod | 6 ++++-- gcp/observability/logging.go | 6 +++--- gcp/observability/observability_test.go | 4 ++-- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 58bcb160e33c..84c2907bbb6d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -106,9 +106,12 @@ jobs: run: | go version go test ${{ matrix.testflags }} -cpu 1,4 -timeout 7m google.golang.org/grpc/... - cd ${GITHUB_WORKSPACE}/security/advancedtls && go test ${{ matrix.testflags }} -timeout 2m google.golang.org/grpc/security/advancedtls/... - cd ${GITHUB_WORKSPACE}/security/authorization && go test ${{ matrix.testflags }} -timeout 2m google.golang.org/grpc/security/authorization/... - + cd "${GITHUB_WORKSPACE}" + for MOD_FILE in $(find . -name 'go.mod' | grep -Ev '^\./go\.mod'); do + pushd "$(dirname ${MOD_FILE})" + go test ${{ matrix.testflags }} -timeout 2m ./... + popd + done # Non-core gRPC tests (examples, interop, etc) - name: Run extras tests diff --git a/gcp/observability/config.go b/gcp/observability/config.go index aea2a2db3298..fd0fc1485f26 100644 --- a/gcp/observability/config.go +++ b/gcp/observability/config.go @@ -26,7 +26,7 @@ import ( gcplogging "cloud.google.com/go/logging" "golang.org/x/oauth2/google" - configpb "google.golang.org/grpc/observability/internal/config" + configpb "google.golang.org/grpc/gcp/observability/internal/config" "google.golang.org/protobuf/encoding/protojson" ) diff --git a/gcp/observability/exporting.go b/gcp/observability/exporting.go index 898f35963ee5..79576eb999f2 100644 --- a/gcp/observability/exporting.go +++ b/gcp/observability/exporting.go @@ -25,7 +25,7 @@ import ( "os" gcplogging "cloud.google.com/go/logging" - grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" + grpclogrecordpb "google.golang.org/grpc/gcp/observability/internal/logging" "google.golang.org/protobuf/encoding/protojson" ) diff --git a/gcp/observability/go.mod b/gcp/observability/go.mod index d622a879e36b..6f4cdd48b231 100644 --- a/gcp/observability/go.mod +++ b/gcp/observability/go.mod @@ -1,4 +1,4 @@ -module google.golang.org/grpc/observability +module google.golang.org/grpc/gcp/observability go 1.14 @@ -7,8 +7,10 @@ require ( github.com/golang/protobuf v1.5.2 github.com/google/uuid v1.3.0 golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.46.0 google.golang.org/protobuf v1.27.1 ) +// TODO(lidiz) remove the following line when we have a release containing the +// necessary internal binary logging changes replace google.golang.org/grpc => ../../ diff --git a/gcp/observability/logging.go b/gcp/observability/logging.go index fc9366440e38..ed7e76d74c04 100644 --- a/gcp/observability/logging.go +++ b/gcp/observability/logging.go @@ -27,9 +27,9 @@ import ( "github.com/google/uuid" binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" + configpb "google.golang.org/grpc/gcp/observability/internal/config" + grpclogrecordpb "google.golang.org/grpc/gcp/observability/internal/logging" iblog "google.golang.org/grpc/internal/binarylog" - configpb "google.golang.org/grpc/observability/internal/config" - grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" ) // translateMetadata translates the metadata from Binary Logging format to @@ -203,7 +203,7 @@ func (l *binaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { // we batch up the uploads in the exporting RPC, the message content of that // RPC will be logged. Without this exclusion, we may end up with an ever // expanding message field in log entries, and crash the process with OOM. - if methodName == "google.logging.v2.LoggingServiceV2/WriteLogEntries" { + if methodName == "/google.logging.v2.LoggingServiceV2/WriteLogEntries" { return ol } diff --git a/gcp/observability/observability_test.go b/gcp/observability/observability_test.go index 1785dcd2fa55..16a3f935a68b 100644 --- a/gcp/observability/observability_test.go +++ b/gcp/observability/observability_test.go @@ -30,14 +30,14 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + configpb "google.golang.org/grpc/gcp/observability/internal/config" + grpclogrecordpb "google.golang.org/grpc/gcp/observability/internal/logging" iblog "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/grpctest" "google.golang.org/grpc/internal/leakcheck" testgrpc "google.golang.org/grpc/interop/grpc_testing" testpb "google.golang.org/grpc/interop/grpc_testing" "google.golang.org/grpc/metadata" - configpb "google.golang.org/grpc/observability/internal/config" - grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" "google.golang.org/grpc/status" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto"