MCPcopy
hub / github.com/grpc/grpc-go / TestSet

Method TestSet

internal/proxyattributes/proxyattributes_test.go:97–116  ·  view source on GitHub ↗

Tests that Set returns a copy of addr with attributes containing correct user and connect address.

(t *testing.T)

Source from the content-addressed store, hash-verified

95// Tests that Set returns a copy of addr with attributes containing correct
96// user and connect address.
97func (s) TestSet(t *testing.T) {
98 addr := resolver.Address{Addr: "test-address"}
99 pOpts := Options{
100 User: url.UserPassword("username", "password"),
101 ConnectAddr: "proxy-address",
102 }
103
104 // Call Set and validate attributes
105 populatedAddr := Set(addr, pOpts)
106 gotOption, attrPresent := Get(populatedAddr)
107 if !attrPresent {
108 t.Errorf("Get(%v) = %v, want %v ", populatedAddr, attrPresent, true)
109 }
110 if got, want := gotOption.ConnectAddr, pOpts.ConnectAddr; got != want {
111 t.Errorf("unexpected ConnectAddr proxy atrribute = %v, want %v", got, want)
112 }
113 if got, want := gotOption.User, pOpts.User; got != want {
114 t.Errorf("unexpected User proxy attribute = %v, want %v", got, want)
115 }
116}

Callers

nothing calls this directly

Calls 3

SetFunction · 0.70
GetFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected