(t *testing.T)
| 330 | } |
| 331 | |
| 332 | func 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 | |
| 374 | func TestRun_ConfigFileWithInvalidPeer(t *testing.T) { |
| 375 | ctx, cancel := context.WithCancel(context.Background()) |
nothing calls this directly
no test coverage detected