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

Method TestCloneServer

credentials/alts/alts_test.go:121–149  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

119}
120
121func (s) TestCloneServer(t *testing.T) {
122 wantServerName := "server.name"
123 c := NewServerCreds(DefaultServerOptions())
124 c.OverrideServerName(wantServerName)
125 cc := c.Clone()
126 if got, want := cc.Info().ServerName, wantServerName; got != want {
127 t.Fatalf("cc.Info().ServerName = %v, want %v", got, want)
128 }
129 cc.OverrideServerName("")
130 if got, want := c.Info().ServerName, wantServerName; got != want {
131 t.Fatalf("Change in clone should not affect the original, c.Info().ServerName = %v, want %v", got, want)
132 }
133 if got, want := cc.Info().ServerName, ""; got != want {
134 t.Fatalf("cc.Info().ServerName = %v, want %v", got, want)
135 }
136
137 ct := c.(*altsTC)
138 cct := cc.(*altsTC)
139
140 if ct.side != cct.side {
141 t.Errorf("cc.side = %q, want %q", cct.side, ct.side)
142 }
143 if ct.hsAddress != cct.hsAddress {
144 t.Errorf("cc.hsAddress = %q, want %q", cct.hsAddress, ct.hsAddress)
145 }
146 if !reflect.DeepEqual(ct.accounts, cct.accounts) {
147 t.Errorf("cc.accounts = %q, want %q", cct.accounts, ct.accounts)
148 }
149}
150
151func (s) TestInfo(t *testing.T) {
152 // This is not testing any handshaker functionality, so it's fine to only

Callers

nothing calls this directly

Calls 7

DefaultServerOptionsFunction · 0.85
NewServerCredsFunction · 0.70
OverrideServerNameMethod · 0.65
CloneMethod · 0.65
InfoMethod · 0.65
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected