MCPcopy
hub / github.com/micro/go-micro / TestEncodingEndpoints

Function TestEncodingEndpoints

registry/consul/encoding_test.go:10–111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestEncodingEndpoints(t *testing.T) {
11 eps := []*registry.Endpoint{
12 {
13 Name: "endpoint1",
14 Request: &registry.Value{
15 Name: "request",
16 Type: "request",
17 },
18 Response: &registry.Value{
19 Name: "response",
20 Type: "response",
21 },
22 Metadata: map[string]string{
23 "foo1": "bar1",
24 },
25 },
26 {
27 Name: "endpoint2",
28 Request: &registry.Value{
29 Name: "request",
30 Type: "request",
31 },
32 Response: &registry.Value{
33 Name: "response",
34 Type: "response",
35 },
36 Metadata: map[string]string{
37 "foo2": "bar2",
38 },
39 },
40 {
41 Name: "endpoint3",
42 Request: &registry.Value{
43 Name: "request",
44 Type: "request",
45 },
46 Response: &registry.Value{
47 Name: "response",
48 Type: "response",
49 },
50 Metadata: map[string]string{
51 "foo3": "bar3",
52 },
53 },
54 }
55
56 testEp := func(ep *registry.Endpoint, enc string) {
57 // encode endpoint
58 e := encodeEndpoints([]*registry.Endpoint{ep})
59
60 // check there are two tags; old and new
61 if len(e) != 1 {
62 t.Fatalf("Expected 1 encoded tags, got %v", e)
63 }
64
65 // check old encoding
66 var seen bool
67

Callers

nothing calls this directly

Calls 6

encodeEndpointsFunction · 0.85
decodeEndpointsFunction · 0.85
FatalMethod · 0.80
encodeFunction · 0.70
MarshalMethod · 0.65
FatalfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…