Skip to content

Commit f8ac2f4

Browse files
GGN Engprod Teambstoll
authored andcommitted
Project import generated by Copybara.
FolderOrigin-RevId: /usr/local/google/home/bstoll/copybara/temp/folder-destination10343318339908624904/.
1 parent 071b1c9 commit f8ac2f4

15 files changed

Lines changed: 78049 additions & 57966 deletions

File tree

binding/grpcutil/grpclog/grpclog_test.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ import (
2525
"golang.org/x/net/context"
2626

2727
"github.com/openconfig/ondatra/binding/grpcutil/testservice"
28-
tgrpcpb "github.com/openconfig/ondatra/binding/grpcutil/testservice/gen"
29-
tpb "github.com/openconfig/ondatra/binding/grpcutil/testservice/gen"
3028
"google.golang.org/grpc"
3129
"google.golang.org/grpc/metadata"
30+
31+
tgrpcpb "github.com/openconfig/ondatra/binding/grpcutil/testservice/gen"
32+
tpb "github.com/openconfig/ondatra/binding/grpcutil/testservice/gen"
3233
)
3334

3435
func TestSanitizeTarget(t *testing.T) {
@@ -38,17 +39,17 @@ func TestSanitizeTarget(t *testing.T) {
3839
want string
3940
}{
4041
{
41-
name: "valid target",
42+
name: "valid_target",
4243
target: "localhost:1234",
4344
want: "localhost_1234",
4445
},
4546
{
46-
name: "target with special chars",
47+
name: "target_with_special_chars",
4748
target: "unix:///tmp/grpc.sock",
4849
want: "unix____tmp_grpc.sock",
4950
},
5051
{
51-
name: "empty target",
52+
name: "empty_target",
5253
target: "",
5354
want: "",
5455
},
@@ -84,7 +85,7 @@ func (*testServer) SendStream(stream tgrpcpb.Test_SendStreamServer) error {
8485
}
8586

8687
func TestInterceptors(t *testing.T) {
87-
ctx := context.Background()
88+
ctx := t.Context()
8889
opts := []grpc.DialOption{
8990
grpc.WithChainUnaryInterceptor(UnaryClientInterceptor()),
9091
grpc.WithChainStreamInterceptor(StreamClientInterceptor()),
@@ -122,14 +123,14 @@ func TestInterceptors(t *testing.T) {
122123
}
123124
sort.Strings(logFiles)
124125

125-
var gotLogs string
126+
var gotLogs strings.Builder
126127
for _, f := range logFiles {
127128
logFile := filepath.Join(logDir, f)
128129
data, err := os.ReadFile(logFile)
129130
if err != nil {
130131
t.Fatalf("Failed to read log file %s: %v", f, err)
131132
}
132-
gotLogs += string(data)
133+
gotLogs.Write(data)
133134
}
134135

135136
wantSubstrings := []string{
@@ -142,9 +143,11 @@ func TestInterceptors(t *testing.T) {
142143
`(Stream /testservice.Test/SendStream) RecvMsg success:`,
143144
`(Stream /testservice.Test/SendStream) RecvMsg error: EOF`,
144145
}
146+
147+
got := gotLogs.String()
145148
for _, want := range wantSubstrings {
146-
if !strings.Contains(gotLogs, want) {
147-
t.Errorf("Log files %v do not contain expected substring %q; combined content:\n%s", logFiles, want, gotLogs)
149+
if !strings.Contains(got, want) {
150+
t.Errorf("Log files %v got:\n%s\nwant to contain substring %q", logFiles, got, want)
148151
}
149152
}
150153
}

gnmi/oc/schema.go

Lines changed: 52869 additions & 52866 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)