(t *testing.T)
| 422 | } |
| 423 | |
| 424 | func TestNewServer(t *testing.T) { |
| 425 | // All of the settings to apply and verify. Currently just testing domain suffix, |
| 426 | // but we should expand this list. |
| 427 | cases := []struct { |
| 428 | name string |
| 429 | domain string |
| 430 | expectedDomain string |
| 431 | enableSecureGRPC bool |
| 432 | jwtRule string |
| 433 | }{ |
| 434 | { |
| 435 | name: "default domain", |
| 436 | domain: "", |
| 437 | expectedDomain: constants.DefaultClusterLocalDomain, |
| 438 | }, |
| 439 | { |
| 440 | name: "default domain with JwtRule", |
| 441 | domain: "", |
| 442 | expectedDomain: constants.DefaultClusterLocalDomain, |
| 443 | jwtRule: `{"issuer": "foo", "jwks_uri": "baz", "audiences": ["aud1", "aud2"]}`, |
| 444 | }, |
| 445 | { |
| 446 | name: "override domain", |
| 447 | domain: "mydomain.com", |
| 448 | expectedDomain: "mydomain.com", |
| 449 | }, |
| 450 | { |
| 451 | name: "override default secured grpc port", |
| 452 | domain: "", |
| 453 | expectedDomain: constants.DefaultClusterLocalDomain, |
| 454 | enableSecureGRPC: true, |
| 455 | }, |
| 456 | } |
| 457 | |
| 458 | for _, c := range cases { |
| 459 | t.Run(c.name, func(t *testing.T) { |
| 460 | configDir := t.TempDir() |
| 461 | |
| 462 | secureGRPCPort := "" |
| 463 | if c.enableSecureGRPC { |
| 464 | secureGRPCPort = ":0" |
| 465 | } |
| 466 | |
| 467 | args := NewPilotArgs(func(p *PilotArgs) { |
| 468 | p.Namespace = "istio-system" |
| 469 | p.ServerOptions = DiscoveryServerOptions{ |
| 470 | // Dynamically assign all ports. |
| 471 | HTTPAddr: ":0", |
| 472 | MonitoringAddr: ":0", |
| 473 | GRPCAddr: ":0", |
| 474 | SecureGRPCAddr: secureGRPCPort, |
| 475 | } |
| 476 | p.RegistryOptions = RegistryOptions{ |
| 477 | KubeOptions: kubecontroller.Options{ |
| 478 | DomainSuffix: c.domain, |
| 479 | }, |
| 480 | FileDir: configDir, |
| 481 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…