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

Function TestRun_ConfigFileWithNoPeerTokens

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

Source from the content-addressed store, hash-verified

330}
331
332func TestRun_ConfigFileWithNoPeerTokens(t *testing.T) {
333 ctx, cancel := context.WithCancel(context.Background())
334 defer cancel()
335
336 proxy1Addr, proxy2Addr := testAddr, generateTestAddr(testAddr, 1)
337 clusterPort, clusterAddr, proxy1BindAddr, _ := generateTestAddrs(proxy1Addr)
338
339 cluster := proxycore.NewMockCluster(net.ParseIP(testStartAddr), clusterPort)
340
341 err := cluster.Add(ctx, 1)
342 require.NoError(t, err)
343
344 defer cluster.Shutdown()
345
346 configFileName, err := writeTempYaml(struct {
347 Bind string
348 Port int
349 RPCAddr string `yaml:"rpc-address"`
350 DataCenter string `yaml:"data-center"`
351 Tokens []string
352 ContactPoints []string `yaml:"contact-points"`
353 Peers []PeerConfig
354 }{
355 Bind: proxy1BindAddr,
356 ContactPoints: []string{clusterAddr},
357 Port: clusterPort,
358 RPCAddr: proxy1Addr,
359 Tokens: []string{"0"}, // Local tokens set
360 Peers: []PeerConfig{{
361 RPCAddr: proxy2Addr,
362 DC: "dc-2",
363 // No peer tokens
364 }},
365 })
366 require.NoError(t, err)
367
368 rc := Run(ctx, []string{
369 "--config", configFileName,
370 })
371 require.Equal(t, 1, rc)
372}
373
374func TestRun_ConfigFileWithInvalidPeer(t *testing.T) {
375 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected