Documentation
¶
Index ¶
- type TestEnv
- func (e *TestEnv) AppendBackendRules(rules []*confpb.BackendRule)
- func (e *TestEnv) AppendHttpRules(rules []*annotationspb.HttpRule)
- func (e *TestEnv) AppendUsageRules(rules []*confpb.UsageRule)
- func (e *TestEnv) DisableHttp2ForHttpsBackend()
- func (e *TestEnv) EnableEchoServerRootPathHandler()
- func (e *TestEnv) EnableScNetworkFailOpen()
- func (e *TestEnv) OverrideAuthentication(authentication *confpb.Authentication)
- func (e *TestEnv) OverrideBackendService(backend platform.Backend)
- func (e *TestEnv) OverrideMockMetadata(newImdsData map[string]string, imdsFailures int)
- func (e *TestEnv) OverrideQuota(quota *confpb.Quota)
- func (e *TestEnv) OverrideRolloutIdAndConfigId(newRolloutId, newConfigId string)
- func (e *TestEnv) OverrideSystemParameters(systemParameters *confpb.SystemParameters)
- func (e *TestEnv) Ports() *platform.Ports
- func (e *TestEnv) RemoveAllBackendRules()
- func (e *TestEnv) ServiceConfigId() string
- func (e *TestEnv) SetAllowCors()
- func (e *TestEnv) SetBackendAddress(backendAddress string)
- func (e *TestEnv) SetBackendAlwaysRespondRST(backendAlwaysRespondRST bool)
- func (e *TestEnv) SetBackendAuthIamDelegates(delegates string)
- func (e *TestEnv) SetBackendAuthIamServiceAccount(serviecAccount string)
- func (e *TestEnv) SetBackendMTLSCert(fileName string)
- func (e *TestEnv) SetBackendNotStart(backendNotStart bool)
- func (e *TestEnv) SetBackendRejectRequestNum(backendFaRequestNum int)
- func (e *TestEnv) SetBackendRejectRequestStatus(backendFaRequestStatus int)
- func (e *TestEnv) SetBookstoreServerHealthState(service string, healthy bool)
- func (e *TestEnv) SetEnvoyDrainTimeInSec(envoyDrainTimeInSec int)
- func (e *TestEnv) SetIamResps(iamResps map[string]string, iamFailures int, iamRespTime time.Duration)
- func (e *TestEnv) SetServiceControlIamDelegates(delegates string)
- func (e *TestEnv) SetServiceControlIamServiceAccount(serviecAccount string)
- func (e *TestEnv) SetUseIPv6Address(b bool)
- func (e *TestEnv) Setup(confArgs []string) error
- func (e *TestEnv) SetupFakeTraceServer(sampleRate float32)
- func (e *TestEnv) SkipEnvoyHealthChecks()
- func (e *TestEnv) SkipHealthChecks()
- func (e *TestEnv) StopBackendServer() error
- func (e *TestEnv) TearDown(t *testing.T)
- func (e *TestEnv) UseWrongBackendCertForDR(useWrongBackendCert bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestEnv ¶
type TestEnv struct { MockMetadataServer *components.MockMetadataServer MockIamServer *components.MockIamServer MockServiceManagementServer *components.MockServiceMrg ServiceControlServer *components.MockServiceCtrl FakeStackdriverServer *components.FakeTraceServer FakeJwtService *components.FakeJwtService StatsVerifier *components.StatsVerifier // contains filtered or unexported fields }
func (*TestEnv) AppendBackendRules ¶
func (e *TestEnv) AppendBackendRules(rules []*confpb.BackendRule)
AppendBackendRules appends Service.Backend.Rules.
func (*TestEnv) AppendHttpRules ¶
func (e *TestEnv) AppendHttpRules(rules []*annotationspb.HttpRule)
AppendHttpRules appends Service.Http.Rules.
func (*TestEnv) AppendUsageRules ¶
AppendUsageRules appends Service.Usage.Rules.
func (*TestEnv) DisableHttp2ForHttpsBackend ¶
func (e *TestEnv) DisableHttp2ForHttpsBackend()
func (*TestEnv) EnableEchoServerRootPathHandler ¶
func (e *TestEnv) EnableEchoServerRootPathHandler()
func (*TestEnv) EnableScNetworkFailOpen ¶
func (e *TestEnv) EnableScNetworkFailOpen()
EnableScNetworkFailOpen sets enableScNetworkFailOpen to be true.
func (*TestEnv) OverrideAuthentication ¶
func (e *TestEnv) OverrideAuthentication(authentication *confpb.Authentication)
OverrideAuthentication overrides Service.Authentication.
func (*TestEnv) OverrideBackendService ¶
OverrideBackend overrides the mock backend only. Warning: This will result in using the service config for the original backend, even though the new backend is spun up.
func (*TestEnv) OverrideMockMetadata ¶
OverrideMockMetadata overrides mock metadata values given path to response map.
func (*TestEnv) OverrideQuota ¶
OverrideQuota overrides Service.Quota.
func (*TestEnv) OverrideRolloutIdAndConfigId ¶
OverrideAuthentication overrides Service.Authentication.
func (*TestEnv) OverrideSystemParameters ¶
func (e *TestEnv) OverrideSystemParameters(systemParameters *confpb.SystemParameters)
OverrideSystemParameters overrides Service.SystemParameters.
func (*TestEnv) RemoveAllBackendRules ¶
func (e *TestEnv) RemoveAllBackendRules()
RemoveAllBackendRules removes all Service.Backend.Rules. This is useful for testing
func (*TestEnv) ServiceConfigId ¶
func (*TestEnv) SetAllowCors ¶
func (e *TestEnv) SetAllowCors()
SetAllowCors Sets AllowCors in API endpoint to true.
func (*TestEnv) SetBackendAddress ¶
func (*TestEnv) SetBackendAlwaysRespondRST ¶
func (*TestEnv) SetBackendAuthIamDelegates ¶
func (*TestEnv) SetBackendAuthIamServiceAccount ¶
func (*TestEnv) SetBackendMTLSCert ¶
SetBackendMTLSCert sets the backend cert file to enable mutual authentication.
func (*TestEnv) SetBackendNotStart ¶
func (*TestEnv) SetBackendRejectRequestNum ¶
func (*TestEnv) SetBackendRejectRequestStatus ¶
func (*TestEnv) SetBookstoreServerHealthState ¶
SetBookstoreServerHealthState set the bookstore server health state
func (*TestEnv) SetEnvoyDrainTimeInSec ¶
SetEnvoyDrainTimeInSec
func (*TestEnv) SetIamResps ¶
func (e *TestEnv) SetIamResps(iamResps map[string]string, iamFailures int, iamRespTime time.Duration)
Dictates the responses and the number of failures mock IAM will respond with.
func (*TestEnv) SetServiceControlIamDelegates ¶
func (*TestEnv) SetServiceControlIamServiceAccount ¶
func (*TestEnv) SetUseIPv6Address ¶
func (*TestEnv) SetupFakeTraceServer ¶
func (*TestEnv) SkipEnvoyHealthChecks ¶
func (e *TestEnv) SkipEnvoyHealthChecks()
SkipEnvoyHealthChecks skips health check on Envoy listener port. But not on admin port Keeping health check on Envoy admin port will help to prevent test flakyness.
func (*TestEnv) SkipHealthChecks ¶
func (e *TestEnv) SkipHealthChecks()
Limit usage of this, as it causes flakes in CI. Only intended to be used to test if Envoy starts up correctly. Ideally, the test using this should have it's own retry loop. Can also call after setup but before teardown to skip teardown checks.
func (*TestEnv) StopBackendServer ¶
func (*TestEnv) UseWrongBackendCertForDR ¶
For use when dynamic routing is enabled. By default, it uses same cert as Envoy for HTTPS calls. When useWrongBackendCert is set to true, purposely fail HTTPS calls for testing.