MCPcopy
hub / github.com/istio/istio / TestNewServer

Function TestNewServer

pilot/pkg/bootstrap/server_test.go:424–505  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

422}
423
424func 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 }

Callers

nothing calls this directly

Calls 11

StartMethod · 0.95
WaitUntilCompletionMethod · 0.95
NewFakeClientFunction · 0.92
EqualFunction · 0.92
NewPilotArgsFunction · 0.85
NewServerFunction · 0.70
RunMethod · 0.65
TempDirMethod · 0.65
EqualFunction · 0.50
ToMethod · 0.45
ExpectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…