File tree 3 files changed +35
-13
lines changed 3 files changed +35
-13
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import (
39
39
"google.golang.org/grpc/codes"
40
40
"google.golang.org/grpc/status"
41
41
"google.golang.org/grpc/xds/internal"
42
+ "google.golang.org/grpc/xds/internal/testutils"
42
43
)
43
44
44
45
const (
@@ -286,7 +287,7 @@ func Test_lrsStore_buildStats_rpcCounts(t *testing.T) {
286
287
)
287
288
}
288
289
upstreamLocalityStats = append (upstreamLocalityStats , & endpointpb.UpstreamLocalityStats {
289
- Locality : l . ToProto ( ),
290
+ Locality : testutils . LocalityIDToProto ( l ),
290
291
TotalSuccessfulRequests : count .success ,
291
292
TotalRequestsInProgress : tempInProgress ,
292
293
TotalErrorRequests : count .failure ,
@@ -298,7 +299,7 @@ func Test_lrsStore_buildStats_rpcCounts(t *testing.T) {
298
299
for l , c := range inProgressCounts {
299
300
if _ , ok := counts [l ]; ! ok {
300
301
upstreamLocalityStats = append (upstreamLocalityStats , & endpointpb.UpstreamLocalityStats {
301
- Locality : l . ToProto ( ),
302
+ Locality : testutils . LocalityIDToProto ( l ),
302
303
TotalRequestsInProgress : c ,
303
304
})
304
305
}
Original file line number Diff line number Diff line change @@ -21,8 +21,6 @@ package internal
21
21
22
22
import (
23
23
"fmt"
24
-
25
- corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
26
24
)
27
25
28
26
type clientID string
@@ -49,12 +47,3 @@ type LocalityID struct {
49
47
func (l LocalityID ) String () string {
50
48
return fmt .Sprintf ("%s-%s-%s" , l .Region , l .Zone , l .SubZone )
51
49
}
52
-
53
- // ToProto convert Locality to the proto representation.
54
- func (l LocalityID ) ToProto () * corepb.Locality {
55
- return & corepb.Locality {
56
- Region : l .Region ,
57
- Zone : l .Zone ,
58
- SubZone : l .SubZone ,
59
- }
60
- }
Original file line number Diff line number Diff line change
1
+ /*
2
+ *
3
+ * Copyright 2020 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ package testutils
19
+
20
+ import (
21
+ corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
22
+ "google.golang.org/grpc/xds/internal"
23
+ )
24
+
25
+ // LocalityIDToProto converts a LocalityID to its proto representation.
26
+ func LocalityIDToProto (l internal.LocalityID ) * corepb.Locality {
27
+ return & corepb.Locality {
28
+ Region : l .Region ,
29
+ Zone : l .Zone ,
30
+ SubZone : l .SubZone ,
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments