MCPcopy Create free account
hub / github.com/cloudflare/cfssl / NewTLSServerGroup

Function NewTLSServerGroup

api/client/client_test.go:152–178  ·  view source on GitHub ↗
(t *testing.T, cert *tls.Certificate)

Source from the content-addressed store, hash-verified

150}
151
152func NewTLSServerGroup(t *testing.T, cert *tls.Certificate) {
153 s := NewServerTLS("https://cfssl1.local:8888, https://cfssl2.local:8888", helpers.CreateTLSConfig(nil, cert))
154
155 ogl, ok := s.(*orderedListGroup)
156 if !ok {
157 t.Fatalf("expected NewServer to return an ordered group list with a list of servers, instead got a %T = %+v", ogl, ogl)
158 }
159
160 if len(ogl.remotes) != 2 {
161 t.Fatalf("expected the remote to have two servers, but it has %d", len(ogl.remotes))
162 }
163
164 hosts := ogl.Hosts()
165 if len(hosts) != 2 {
166 t.Fatalf("expected 2 hosts in the group, but have %d", len(hosts))
167 }
168
169 if hosts[0] != "https://cfssl1.local:8888" {
170 t.Fatalf("expected to see https://cfssl1.local:8888, but saw %s",
171 hosts[0])
172 }
173
174 if hosts[1] != "https://cfssl2.local:8888" {
175 t.Fatalf("expected to see https://cfssl2.local:8888, but saw %s",
176 hosts[1])
177 }
178}
179
180func TestNewOGLGroup(t *testing.T) {
181 strategy := StrategyFromString("ordered_list")

Callers 2

TestNewTLSServerGroupFunction · 0.85

Calls 3

CreateTLSConfigFunction · 0.92
NewServerTLSFunction · 0.85
HostsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…