Documentation ¶
Overview ¶
Package routegentest contains test helpers to test route generators.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FactoryErrorOPTestCase ¶
type FactoryErrorOPTestCase struct { Desc string ServiceConfigIn *servicepb.Service // OptsIn is the input ESPv2 Options. // Will be merged with defaults. OptsIn options.ConfigGeneratorOptions // WantFactoryError is the error that occurs when `NewXYZRouteGenFromOPConfig()` // is called. WantFactoryError string }
FactoryErrorOPTestCase is the shared struct to test a RouteGenerator with One Platform config. It checks that the factory returns an error.
func (*FactoryErrorOPTestCase) RunTest ¶
func (tc *FactoryErrorOPTestCase) RunTest(t *testing.T, factory routegen.RouteGeneratorOPFactory)
RunTest is a test helper to run the test.
type GenConfigErrorOPTestCase ¶
type GenConfigErrorOPTestCase struct { Desc string ServiceConfigIn *servicepb.Service // OptsIn is the input ESPv2 Options. // Will be merged with defaults. OptsIn options.ConfigGeneratorOptions // OptsMergeBehavior is implementation detail on how opts are merged into // default ESPv2 opts. Useful to manually set when dealing with opts // that default to true, but you want to set to false (empty value). // // See https://github.com/imdario/mergo/issues/129 for an example. // // If specified, make sure `OptsIn` contains ALL options you need, as defaults // will most likely be ignored. OptsMergeBehavior func(*mergo.Config) // Additional per-route configurations to generate. FilterGens []filtergen.FilterGenerator // WantGenErrors is the expected error from the generator. WantGenError string }
GenConfigErrorOPTestCase is the shared struct to test a RouteGenerator with One Platform config. It checks that the factory is successful, but the route generation returns an error.
func (*GenConfigErrorOPTestCase) RunTest ¶
func (tc *GenConfigErrorOPTestCase) RunTest(t *testing.T, factory routegen.RouteGeneratorOPFactory)
RunTest is a test helper to run the test.
type SuccessOPTestCase ¶
type SuccessOPTestCase struct { Desc string ServiceConfigIn *servicepb.Service // OptsIn is the input ESPv2 Options. // Will be merged with defaults. OptsIn options.ConfigGeneratorOptions // OptsMergeBehavior is implementation detail on how opts are merged into // default ESPv2 opts. Useful to manually set when dealing with opts // that default to true, but you want to set to false (empty value). // // See https://github.com/imdario/mergo/issues/129 for an example. // // If specified, make sure `OptsIn` contains ALL options you need, as defaults // will most likely be ignored. OptsMergeBehavior func(*mergo.Config) // Additional per-route configurations to generate. FilterGens []filtergen.FilterGenerator // WantHostConfig is the expected virtual host config, in JSON. // Only the routes are populated and verified against the generated routes. WantHostConfig string }
SuccessOPTestCase is the shared struct to test a RouteGenerator with One Platform config. It checks the factory and generator both succeed.
func (*SuccessOPTestCase) RunTest ¶
func (tc *SuccessOPTestCase) RunTest(t *testing.T, factory routegen.RouteGeneratorOPFactory)
RunTest is a test helper to run the test.