filtergentest

package
v0.0.0-...-32f485c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package filtergentest contains test helpers to test filter 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 `NewXYZFilterGensFromOPConfig()`
	// is called.
	WantFactoryError string
}

FactoryErrorOPTestCase is the shared struct to test a FilterGenerator with One Platform config. It checks that the factory returns an error.

func (*FactoryErrorOPTestCase) RunTest

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

	// WantGenErrors are the expected errors from each generator.
	WantGenErrors []string
}

GenConfigErrorOPTestCase is the shared struct to test a FilterGenerator with One Platform config. It checks that the factory is successful, but the filter generation returns an error.

func (*GenConfigErrorOPTestCase) RunTest

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)

	// OnlyCheckFilterConfig indicates the WantFilterConfigs only represents
	// the filter config proto, not the surrounding HTTP filter.
	OnlyCheckFilterConfig bool

	// WantFilterConfigs is the expected filter config message per generator.
	// It is an ordered slice. Each element is the JSON representation of the
	// filter config.
	WantFilterConfigs []string
}

SuccessOPTestCase is the shared struct to test a FilterGenerator with One Platform config. It checks the factory and generator both succeed.

func (*SuccessOPTestCase) RunTest

RunTest is a test helper to run the test.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL