MCPcopy Create free account
hub / github.com/datastax/cql-proxy / TestRun_ConfigFileWithInvalidPeer

Function TestRun_ConfigFileWithInvalidPeer

proxy/run_test.go:374–413  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

372}
373
374func TestRun_ConfigFileWithInvalidPeer(t *testing.T) {
375 ctx, cancel := context.WithCancel(context.Background())
376 defer cancel()
377
378 proxy1Addr := testAddr
379 clusterPort, clusterAddr, proxy1BindAddr, _ := generateTestAddrs(proxy1Addr)
380
381 cluster := proxycore.NewMockCluster(net.ParseIP(testStartAddr), clusterPort)
382
383 err := cluster.Add(ctx, 1)
384 require.NoError(t, err)
385
386 defer cluster.Shutdown()
387
388 configFileName, err := writeTempYaml(struct {
389 Bind string
390 Port int
391 RPCAddr string `yaml:"rpc-address"`
392 DataCenter string `yaml:"data-center"`
393 ContactPoints []string `yaml:"contact-points"`
394 HealthCheck bool `yaml:"health-check"`
395 HttpBind string `yaml:"http-bind"`
396 Peers []PeerConfig
397 }{
398 ContactPoints: []string{clusterAddr},
399 Bind: proxy1BindAddr,
400 RPCAddr: proxy1Addr,
401 Port: clusterPort,
402 Peers: []PeerConfig{{
403 RPCAddr: "", // Empty
404 DC: "dc-2",
405 }},
406 })
407 require.NoError(t, err)
408
409 rc := Run(ctx, []string{
410 "--config", configFileName,
411 })
412 require.Equal(t, 1, rc)
413}
414
415func TestRun_ProxyTLS(t *testing.T) {
416 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 6

AddMethod · 0.95
ShutdownMethod · 0.95
NewMockClusterFunction · 0.92
generateTestAddrsFunction · 0.85
writeTempYamlFunction · 0.85
RunFunction · 0.85

Tested by

no test coverage detected