func init()

in pkg/cloud/rgraph/workflow/testlib/lb/tcproute.go [24:87]


func init() {
	start := func() *rgraph.Graph {
		ezg := ez.Graph{
			Nodes: []ez.Node{
				{Name: "tcp-route", Refs: []ez.Ref{{Field: "Rules.Action.Destinations.ServiceName", To: "bs"}}},
				{Name: "bs", Refs: []ez.Ref{{Field: "Backends.Group", To: "us-central1-b/neg"}, {Field: "Healthchecks", To: "hc"}}},

				{Name: "hc"},
				{Name: "neg", Zone: "us-central1-b"},
			},
		}
		return ezg.Builder().MustBuild()
	}

	testlib.Register(&testlib.TestCase{
		Name:        "lb/tcp-route",
		Description: "Create a lb with tcp route.",
		Steps: []testlib.Step{
			{
				Description: "Create TcpRoute LB",
				Graph:       start(),
			},
		},
	})

	update := func() *rgraph.Graph {
		ezg := ez.Graph{
			Nodes: []ez.Node{
				{Name: "tcp-route", Refs: []ez.Ref{
					{Field: "Rules.Action.Destinations.ServiceName", To: "bs"},
					{Field: "Rules.Action.Destinations.ServiceName", To: "bs1"},
				}},
				{Name: "bs", Refs: []ez.Ref{{Field: "Backends.Group", To: "us-central1-b/neg"}, {Field: "Healthchecks", To: "hc"}}},
				{Name: "hc"},

				{Name: "bs1", Refs: []ez.Ref{{Field: "Backends.Group", To: "us-central1-c/neg"}, {Field: "Healthchecks", To: "hc1"}}},
				{Name: "hc1"},

				{Name: "neg", Zone: "us-central1-b"},
				{Name: "neg", Zone: "us-central1-c"},
			},
		}
		return ezg.Builder().MustBuild()
	}

	testlib.Register(&testlib.TestCase{
		Name:        "lb/tcp-route-multi-bs",
		Description: "Create a lb with multiple backends for tcp route.",
		Steps: []testlib.Step{
			{
				Description: "Create TcpRoute LB",
				Graph:       start(),
			},
			{
				Description: "Add backend service",
				Graph:       update(),
			},
			{
				Description: "Remove backend service",
				Graph:       start(),
			},
		},
	})
}