Documentation ¶
Overview ¶
Package integration is a generated GoMock package.
Index ¶
- Constants
- func AppFromContext(ctx context.Context) string
- func AssertVars(ctx context.Context, t *testing.T, kf *Kf, appName string, ...)
- func BrokerFromContext(ctx context.Context) string
- func CancelOnSignal(ctx context.Context, cancel func(), t *testing.T)
- func CheckApp(ctx context.Context, t *testing.T, kf *Kf, appName string, ...)
- func CheckCluster(ctx context.Context, kf *Kf)
- func CheckEchoApp(ctx context.Context, t *testing.T, kf *Kf, appName string, ...)
- func CheckEnvApp(ctx context.Context, t *testing.T, kf *Kf, appName string, ...)
- func CheckHelloWorldApp(ctx context.Context, t *testing.T, kf *Kf, appName string, ...)
- func CheckSigtermApp(ctx context.Context, t *testing.T, kf *Kf, appName string)
- func CombineOutput(ctx context.Context, t *testing.T, out KfTestOutput) <-chan string
- func CombineOutputStr(ctx context.Context, t *testing.T, out KfTestOutput, errs <-chan error) []string
- func Compile(ctx context.Context, t *testing.T, codePath string) string
- func CompileKf(ctx context.Context, t *testing.T) string
- func ContextWithApp(ctx context.Context, appName string) context.Context
- func ContextWithBroker(ctx context.Context, brokerName string) context.Context
- func ContextWithMetricLabels(ctx context.Context, labels MetricLabels) context.Context
- func ContextWithMetricLogger(ctx context.Context, out MetricLogger) context.Context
- func ContextWithServiceClass(ctx context.Context, serviceClassName string) context.Context
- func ContextWithServiceInstance(ctx context.Context, serviceInstanceName string) context.Context
- func ContextWithServicePlan(ctx context.Context, servicePlanName string) context.Context
- func ContextWithSpace(ctx context.Context, space string) context.Context
- func ContextWithStackdriverOutput(ctx context.Context) context.Context
- func CreateTempDir(ctx context.Context, t *testing.T) string
- func DetachContext(ctx context.Context) context.Context
- func ExpectedAddr(hostname, urlPath string) string
- func Logf(t *testing.T, format string, i ...interface{})
- func RetryGet(ctx context.Context, t *testing.T, addr string, duration time.Duration, ...) (*http.Response, func())
- func RetryPost(ctx context.Context, t *testing.T, addr string, duration time.Duration, ...) (*http.Response, func())
- func RootDir(ctx context.Context, t *testing.T) string
- func RunIntegrationTest(ctx context.Context, t *testing.T, ...)
- func RunKfTest(ctx context.Context, t *testing.T, test KfTest)
- func RunKubeAPITest(ctx context.Context, t *testing.T, ...)
- func ServiceClassFromContext(ctx context.Context) string
- func ServiceInstanceFromContext(ctx context.Context) string
- func ServicePlanFromContext(ctx context.Context) string
- func ShouldSkipIntegration(t *testing.T) bool
- func SpaceFromContext(ctx context.Context) string
- func StreamOutput(ctx context.Context, t *testing.T, out KfTestOutput, errs <-chan error)
- func TestID() string
- func UpdateConfigMapBuildpack(ctx context.Context, t *testing.T, ...)
- func WithApp(ctx context.Context, t *testing.T, kf *Kf, appName string, path string, ...)
- func WithAppArgs(ctx context.Context, t *testing.T, kf *Kf, appName string, path string, ...)
- func WithDynamicClient(ctx context.Context, t *testing.T, callback func(client dynamic.Interface))
- func WithKubernetes(ctx context.Context, t *testing.T, callback func(k8s *kubernetes.Clientset))
- func WithNodeLabel(ctx context.Context, labelName string, t *testing.T, ...)
- func WithRestConfig(ctx context.Context, t *testing.T, callback func(cfg *rest.Config))
- func WithSpace(ctx context.Context, t *testing.T, callback func(namespace string))
- func WithTaskApp(ctx context.Context, t *testing.T, kf *Kf, appName string, path string, ...)
- func WithWontFailContext(ctx context.Context) context.Context
- func WriteMetric(ctx context.Context, m Metric)
- type AppInfo
- type FakeMetricLogger
- type FakeMetricLoggerMockRecorder
- type Float64Gauge
- type Int64Gauge
- type JobInfo
- type Kf
- func (k *Kf) App(ctx context.Context, name string) json.RawMessage
- func (k *Kf) Apps(ctx context.Context) map[string]AppInfo
- func (k *Kf) BindService(ctx context.Context, appName string, serviceInstanceName string, ...)
- func (k *Kf) Bindings(ctx context.Context, extraArgs ...string) []string
- func (k *Kf) Buildpacks(ctx context.Context) []string
- func (k *Kf) CachePush(ctx context.Context, appName, source string, args ...string) bool
- func (k *Kf) CachePushV2(ctx context.Context, appName, source string, args ...string) bool
- func (k *Kf) ConfigureSpace(ctx context.Context, extraArgs ...string) []string
- func (k *Kf) CreateRoute(ctx context.Context, domain string, extraArgs ...string)
- func (k *Kf) CreateService(ctx context.Context, serviceClass string, servicePlan string, ...)
- func (k *Kf) CreateServiceBroker(ctx context.Context, brokerName string, username string, password string, ...)
- func (k *Kf) CreateSpace(ctx context.Context) (string, []string)
- func (k *Kf) CreateUserProvidedService(ctx context.Context, serviceInstanceName string, extraArgs ...string)
- func (k *Kf) CreateVolumeService(ctx context.Context, serviceInstanceName string, extraArgs ...string)
- func (k *Kf) Delete(ctx context.Context, appName string, extraArgs ...string)
- func (k *Kf) DeleteRoute(ctx context.Context, domain string, extraArgs ...string)
- func (k *Kf) DeleteService(ctx context.Context, serviceInstanceName string, extraArgs ...string)
- func (k *Kf) DeleteServiceBroker(ctx context.Context, brokerName string, extraArgs ...string)
- func (k *Kf) DeleteSpace(ctx context.Context, space string) []string
- func (k *Kf) Doctor(ctx context.Context, extraArgs ...string)
- func (k *Kf) Env(ctx context.Context, appName string) map[string]string
- func (k *Kf) JobSchedules(ctx context.Context, appName string) []JobInfo
- func (k *Kf) Jobs(ctx context.Context, appName string) []JobInfo
- func (k *Kf) Logs(ctx context.Context, appName string, extraArgs ...string) (<-chan string, <-chan error)
- func (k *Kf) MapRoute(ctx context.Context, appName, domain string, extraArgs ...string)
- func (k *Kf) Marketplace(ctx context.Context, extraArgs ...string) []string
- func (k *Kf) Push(ctx context.Context, appName string, extraArgs ...string)
- func (k *Kf) Restart(ctx context.Context, appName string)
- func (k *Kf) Routes(ctx context.Context) []string
- func (k *Kf) RunCommand(ctx context.Context, cmd string, extraArgs ...string)
- func (k *Kf) RunSynchronous(ctx context.Context, cfg KfTestConfig) (stdout, stderr []byte, err error)
- func (k *Kf) SSH(ctx context.Context, appName string, extraArgs ...string) []string
- func (k *Kf) Scale(ctx context.Context, appName string, scale string)
- func (k *Kf) Services(ctx context.Context, extraArgs ...string) []string
- func (k *Kf) SetEnv(ctx context.Context, appName, name, value string)
- func (k *Kf) SpaceUsers(ctx context.Context) []SpaceUser
- func (k *Kf) Spaces(ctx context.Context) []string
- func (k *Kf) Stacks(ctx context.Context) []string
- func (k *Kf) Start(ctx context.Context, appName string)
- func (k *Kf) Stop(ctx context.Context, appName string)
- func (k *Kf) Target(ctx context.Context, namespace string) []string
- func (k *Kf) Tasks(ctx context.Context, appName string) []TaskInfo
- func (k *Kf) UnbindService(ctx context.Context, appName string, serviceInstanceName string, ...)
- func (k *Kf) UnmapRoute(ctx context.Context, appName, domain string, extraArgs ...string)
- func (k *Kf) UnsetEnv(ctx context.Context, appName, name string)
- func (k *Kf) UpdateUserProvidedService(ctx context.Context, serviceInstanceName string, extraArgs ...string)
- func (k *Kf) VcapServices(ctx context.Context, extraArgs ...string) []byte
- func (k *Kf) VerifyEchoLogsOutput(ctx context.Context, appName string, expectedLogLine string, ...)
- func (k *Kf) VerifyLogOutput(ctx context.Context, appName string, expectedLogLine string, ...)
- func (k *Kf) VerifyTaskLogOutput(ctx context.Context, appName string, expectedLogLine string, ...)
- func (k *Kf) WaitForCluster(ctx context.Context)
- func (k *Kf) WithProxy(ctx context.Context, appName string, f func(addr string))
- func (k *Kf) WithProxyRoute(ctx context.Context, routeHost string, f func(addr string))
- func (k *Kf) WrapV2Buildpack(ctx context.Context, buildpackName, v2URL string, extraArgs ...string)
- type KfTest
- type KfTestConfig
- type KfTestOutput
- type Metric
- type MetricLabels
- type MetricLogger
- type SpaceUser
- type TaskInfo
Examples ¶
Constants ¶
const ( // EnvPreCompiledKfCLI is the environment variable used to store the // location of a pre-compiled Kf CLI. If it's not set, then the tests will // compile the CLI. EnvPreCompiledKfCLI = "KF_CLI_PATH" // InternalDefaultDomain is the apps.internal domain which is configured by default for all spaces. InternalDefaultDomain = "apps.internal" // EgressMetricsEnvVar is the environment variable that when set to // 'true', will write benchmarking results to Stackdriver. EgressMetricsEnvVar = "EGRESS_TEST_RESULTS" // IntegrationTestID sets the test_id label on metrics. If not provided, a // random id is selected. IntegrationTestID = "INTEGRATION_TEST_ID" // CustomMetricLabels is a comma separated list of labels the user wants // included with each metric that is written. The format is // key1=value1,key2=value2 // // Example: // // CUSTOM_METRIC_LABELS="foo=a,bar=b,baz=c" CustomMetricLabels = "CUSTOM_METRIC_LABELS" // KeepSpaces will prevent the spaces from being cleaned up. KeepSpaces = "KEEP_SPACES" // RandomSpaceNameEnvVar will create random space names instead of // deterministic ones. RandomSpaceNameEnvVar = "RANDOM_SPACE_NAMES" // SkipDoctorEnvVar when set to true, will NOT run kf doctor before tests. SkipDoctorEnvVar = "SKIP_DOCTOR" // SpaceDomainEnvVar is used to override the space domain used at the integration test. // The default space domain is integration-tests.kf.dev, but it needs to be overridden // to be nip.io in BareMetal environment for tests to pass, see b/195313679. SpaceDomainEnvVar = "SPACE_DOMAIN" // DefaultSpaceDomain is the default space domain used for integration // tests. It is overriden by SpaceDomainEnvVar if set. DefaultSpaceDomain = "integration-tests.kf.dev" // IsBareMetalEnvVar when set to true, indicates that tests are running at a BareMetal environment. IsBareMetalEnvVar = "BARE_METAL" PinnedBuildPackName = "go_buildpack_v47" PinnedBuildPackURL = "https://github.com/cloudfoundry/go-buildpack.git#v1.9.47" )
const (
AppCacheEnv = "APP_CACHE"
)
Variables ¶
This section is empty.
Functions ¶
func AppFromContext ¶
AppFromContext returns the service plan name given a context that has been setup via ContextWithApp.
func AssertVars ¶
func AssertVars( ctx context.Context, t *testing.T, kf *Kf, appName string, expectedVars map[string]string, absentVars []string, )
AssertVars uses Env and the output of the App to ensure the expected variables. It will retry for a while if the environment variables aren't returning the correct values. This is to give the enventually consistent system time to catch-up.
func BrokerFromContext ¶
BrokerFromContext returns the broker name given a context that has been setup via ContextWithBroker.
func CancelOnSignal ¶
CancelOnSignal watches for a kill signal. If it gets one, it invokes the cancel function. An aditional signal will exit the process. If the given context finishes, the underlying go-routine finishes.
func CheckApp ¶
func CheckApp( ctx context.Context, t *testing.T, kf *Kf, appName string, expectedRoutes []string, assert func(ctx context.Context, t *testing.T, addr string), )
CheckApp runs the given function against the given App.
func CheckCluster ¶
CheckCluster runs the Doctor command to ensure the K8s cluster is healthy. It will cache the results and therefore can be ran multiple times.
func CheckEchoApp ¶
func CheckEchoApp( ctx context.Context, t *testing.T, kf *Kf, appName string, expectedRoutes ...string, )
CheckEchoApp checks the echo App.
func CheckEnvApp ¶
func CheckEnvApp( ctx context.Context, t *testing.T, kf *Kf, appName string, expectedVars map[string]string, expectedRoutes ...string, )
CheckEnvApp checks the env App.
func CheckHelloWorldApp ¶
func CheckHelloWorldApp( ctx context.Context, t *testing.T, kf *Kf, appName string, expectedRoutes ...string, )
CheckHelloWorldApp checks the hello world App.
func CheckSigtermApp ¶
func CombineOutput ¶
CombineOutput writes the Stdout and Stderr to a channel for each line.
func CombineOutputStr ¶
func CombineOutputStr(ctx context.Context, t *testing.T, out KfTestOutput, errs <-chan error) []string
CombineOutputStr writes the Stdout and Stderr string. It will return when ctx is done.
func Compile ¶
Compile compiles a path in the repo. It returns a path to the resulting binary. codePath must be relative to RootDir.
func CompileKf ¶
CompileKf compiles the `kf` binary or the path set by PRE_COMPILED_KF_CLI. It returns a string to the resulting binary.
func ContextWithApp ¶
ContextWithApp returns a context that has the App information. The App name can be fetched via AppFromContext.
func ContextWithBroker ¶
ContextWithBroker returns a context that has the service broker information. The broker name can be fetched via BrokerFromContext.
func ContextWithMetricLabels ¶
func ContextWithMetricLabels(ctx context.Context, labels MetricLabels) context.Context
ContextWithMetricLabels returns a Context that stores the given labels. The labels are used when writing a Metric. If there are labels already set on the context, they will be joined deferring to the new labels.
Example ¶
package main import ( "context" "fmt" "github.com/google/kf/v2/pkg/kf/testutil/integration" ) func main() { ctx := integration.ContextWithMetricLabels(context.Background(), integration.MetricLabels{ "a": "wrong", "c": "3", }) ctx = integration.ContextWithMetricLabels(ctx, integration.MetricLabels{ "a": "1", "b": "2", }) m := integration.MetricLabelsFromContext(ctx) fmt.Println(m["a"]) fmt.Println(m["b"]) fmt.Println(m["c"]) }
Output: 1 2 3
func ContextWithMetricLogger ¶
func ContextWithMetricLogger(ctx context.Context, out MetricLogger) context.Context
ContextWithMetricLogger returns a Context that stores the given MetricLogger. The writer is used when writing metrics. It should be used with MetricLoggerFromContext().
func ContextWithServiceClass ¶
ContextWithServiceClass returns a context that has the service class information. The service class name can be fetched via ServiceClassFromContext.
func ContextWithServiceInstance ¶
ContextWithServiceInstance returns a context that has the service instance information. The service instance name can be fetched via ServiceInstanceFromContext.
func ContextWithServicePlan ¶
ContextWithServicePlan returns a context that has the service plan information. The service plan name can be fetched via ServiceInstanceFromContext.
func ContextWithSpace ¶
ContextWithSpace returns a context that has the space information. The space can be fetched via SpaceFromContext.
func ContextWithStackdriverOutput ¶
ContextWithStackdriverOutput is a wrapper around ContextWithMetricLogger that uses a Stackdriver client. If setting up the client fails, then a writer isn't set and the error is logged to the standard logger.
func CreateTempDir ¶
CreateTempDir returns a temp directory that will be cleaned up when the context finishes.
func DetachContext ¶
DetachContext returns a context from the given context that does not have the underlying deadline, error, or done channel. It JUST takes the underlying values.
func ExpectedAddr ¶
ExpectedAddr returns the expected address for integration tests given a hostname and URL path.
func Logf ¶
Logf will write to Stderr if testing.Verbose is true and t.Log otherwise. This is so logs will stream out instead of only being displayed at the end of the test.
func RetryGet ¶
func RetryGet( ctx context.Context, t *testing.T, addr string, duration time.Duration, expectedStatusCode int, ) (*http.Response, func())
RetryGet will send a get request until successful, duration has been reached or context is done. A close function is returned for closing the sub-context.
func RetryPost ¶
func RetryPost( ctx context.Context, t *testing.T, addr string, duration time.Duration, expectedStatusCode int, body string, ) (*http.Response, func())
RetryPost will post until successful, duration has been reached or context is done. A close function is returned for closing the sub-context.
func RootDir ¶
RootDir uses git to find the root of the directory. This is useful for tests (especially integration ones that compile things).
func RunIntegrationTest ¶
func RunIntegrationTest( ctx context.Context, t *testing.T, test func(ctx context.Context, t *testing.T), )
RunIntegrationTest skips the tests if testing.Short() is true (via --short flag). Otherwise it runs the given test.
func RunKfTest ¶
RunKfTest runs 'kf' for integration tests. It first compiles 'kf' and then launches it as a sub-process. It will set the args and environment variables accordingly. It will run the given test with the resulting STDOUT, STDERR and STDIN. It will cleanup the sub-process on completion via the context.
func RunKubeAPITest ¶
func RunKubeAPITest( ctx context.Context, t *testing.T, test func(ctx context.Context, t *testing.T), )
RunKubeAPITest is for executing tests against the Kubernetes API directly.
func ServiceClassFromContext ¶
ServiceClassFromContext returns the service class name given a context that has been setup via ContextWithServiceClass.
func ServiceInstanceFromContext ¶
ServiceInstanceFromContext returns the service instance name given a context that has been setup via ContextWithServiceInstance.
func ServicePlanFromContext ¶
ServicePlanFromContext returns the service plan name given a context that has been setup via ContextWithServicePlan.
func ShouldSkipIntegration ¶
ShouldSkipIntegration returns true if integration tests are being skipped.
func SpaceFromContext ¶
SpaceFromContext returns the space name given a context that has been setup via ContextWithSpace.
func StreamOutput ¶
StreamOutput writes the output of KfTestOutput to the testing.Log if testing.Verbose is false and Stderr otherwise.
func TestID ¶
func TestID() string
TestID returns a ID. This is either populated by IntegrationTestID (if provided), or a random value.
func UpdateConfigMapBuildpack ¶ added in v2.11.7
func UpdateConfigMapBuildpack(ctx context.Context, t *testing.T, test func(ctx context.Context, t *testing.T))
UpdateConfigMapBuildpack adds a new buildpack with a tagged url to the config-defaults configmap in the kf namespace
func WithApp ¶
func WithApp(ctx context.Context, t *testing.T, kf *Kf, appName string, path string, isBroker bool, callback func(newCtx context.Context))
WithApp creates an App and deletes it after the test is done.
func WithAppArgs ¶
func WithAppArgs(ctx context.Context, t *testing.T, kf *Kf, appName string, path string, isBroker bool, args []string, callback func(newCtx context.Context))
WithAppArgs creates an App with provided args and deletes it after the test is done.
func WithDynamicClient ¶
WithDynamicClient creates a dynamic Kubernetes client from the config on the context and passes it to the callback.
func WithKubernetes ¶
WithKubernetes creates a Kubernetes client from the config on the context and passes it to the callback.
func WithNodeLabel ¶
func WithNodeLabel(ctx context.Context, labelName string, t *testing.T, callback func(labelValue string, nodeName string, k8s *kubernetes.Clientset))
WithNodeLabel adds a random value for the given LabelName on the 1st node in the pool.
func WithRestConfig ¶
WithRestConfig gets the rest config from the context and passes it to the callback.
func WithSpace ¶
WithSpace creates a space and deletes it after the test is done. It can be used within the context of a RunKubeAPITest.
func WithTaskApp ¶
func WithTaskApp(ctx context.Context, t *testing.T, kf *Kf, appName string, path string, isBroker bool, callback func(newCtx context.Context))
WithTaskApp creates an App for running task and deletes it after the test is done.
func WithWontFailContext ¶
WithWontFailContext returns a context that tells the kf function to NOT fail on an error. This is useful during cleanup operationos (e.g., deleting Spaces) that might not finish before the test process closes out (which would cause spurious errors).
func WriteMetric ¶
WriteMetric writes the metric as a structured log to the output set by ContextWithMetricLogger(). If no writer is set, then this function is a NOP.
Any labels in the `context.Context` set by ContextWithMetricLabels() are joined with the labels in the Metric.
Types ¶
type AppInfo ¶
type AppInfo struct { Name string Instances string Memory string Disk string CPU string URLs []string Ready string Reason string }
AppInfo is the information returned by listing an App. It is returned by ListApp.
type FakeMetricLogger ¶
type FakeMetricLogger struct {
// contains filtered or unexported fields
}
FakeMetricLogger is a mock of MetricLogger interface.
func NewFakeMetricLogger ¶
func NewFakeMetricLogger(ctrl *gomock.Controller) *FakeMetricLogger
NewFakeMetricLogger creates a new mock instance.
func (*FakeMetricLogger) EXPECT ¶
func (m *FakeMetricLogger) EXPECT() *FakeMetricLoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type FakeMetricLoggerMockRecorder ¶
type FakeMetricLoggerMockRecorder struct {
// contains filtered or unexported fields
}
FakeMetricLoggerMockRecorder is the mock recorder for FakeMetricLogger.
func (*FakeMetricLoggerMockRecorder) LogSync ¶
func (mr *FakeMetricLoggerMockRecorder) LogSync(arg0, arg1 interface{}) *gomock.Call
LogSync indicates an expected call of LogSync.
type Float64Gauge ¶
type Float64Gauge struct { Name string Labels MetricLabels Value float64 }
Float64Gauge writes an float64 value along with a name.
type Int64Gauge ¶
type Int64Gauge struct { Name string Units string Labels MetricLabels Value int64 }
Int64Gauge writes an int64 value along with a name.
type Kf ¶
type Kf struct {
// contains filtered or unexported fields
}
Kf provides a DSL for running integration tests.
func (*Kf) BindService ¶
func (k *Kf) BindService(ctx context.Context, appName string, serviceInstanceName string, extraArgs ...string)
BindService runs the bind-service command.
func (*Kf) Buildpacks ¶
Buildpacks runs the buildpacks command.
func (*Kf) CachePush ¶
CachePush pushes an App with V3 buildpack and caches the source or uses a cached version. This is incompatible with additional arguments that might change the semantics of push. It returns true if the cache was used.
func (*Kf) CachePushV2 ¶
CachePushV2 pushes an App with V2 buildpack and caches the source or uses a cached version. This is incompatible with additional arguments that might change the semantics of push. It returns true if the cache was used.
func (*Kf) ConfigureSpace ¶
ConfigureSpace runs any configure-space sub-command with the space configured on the context.
func (*Kf) CreateRoute ¶
CreateRoute runs the create-route command.
func (*Kf) CreateService ¶
func (k *Kf) CreateService(ctx context.Context, serviceClass string, servicePlan string, serviceInstanceName string, extraArgs ...string)
CreateService runs the create-service command.
func (*Kf) CreateServiceBroker ¶
func (k *Kf) CreateServiceBroker(ctx context.Context, brokerName string, username string, password string, url string, extraArgs ...string)
CreateServiceBroker runs the create-service-broker command.
func (*Kf) CreateSpace ¶
CreateSpace runs the create-space command.
func (*Kf) CreateUserProvidedService ¶
func (k *Kf) CreateUserProvidedService(ctx context.Context, serviceInstanceName string, extraArgs ...string)
CreateUserProvidedService runs the create-user-provided-service command.
func (*Kf) CreateVolumeService ¶
func (k *Kf) CreateVolumeService(ctx context.Context, serviceInstanceName string, extraArgs ...string)
CreateVolumeService runs the create-service command and create a VolumeServiceInstance.
func (*Kf) DeleteRoute ¶
DeleteRoute runs the delete-route command.
func (*Kf) DeleteService ¶
DeleteService runs the delete-service command.
func (*Kf) DeleteServiceBroker ¶
DeleteServiceBroker runs the delete-service-broker command.
func (*Kf) DeleteSpace ¶
DeleteSpace runs the delete-space command. This command is run asynchronously since every test uses a unique space.
func (*Kf) Logs ¶
func (k *Kf) Logs(ctx context.Context, appName string, extraArgs ...string) (<-chan string, <-chan error)
Logs displays the logs of an App.
func (*Kf) Marketplace ¶
Marketplace runs the marketplace command and returns the output.
func (*Kf) RunCommand ¶
RunCommand runs the provided commanded with provided args.
func (*Kf) RunSynchronous ¶
func (k *Kf) RunSynchronous(ctx context.Context, cfg KfTestConfig) (stdout, stderr []byte, err error)
RunSynchronous runs kf with the provided configuration and returns the results.
func (*Kf) SpaceUsers ¶
SpaceUsers returns a list of space users within the current space.
func (*Kf) UnbindService ¶
func (k *Kf) UnbindService(ctx context.Context, appName string, serviceInstanceName string, extraArgs ...string)
UnbindService runs the unbind-service command.
func (*Kf) UnmapRoute ¶
UnmapRoute runs the unmap-route command.
func (*Kf) UpdateUserProvidedService ¶
func (k *Kf) UpdateUserProvidedService(ctx context.Context, serviceInstanceName string, extraArgs ...string)
UpdateUserProvidedService runs the update-user-provided-service command.
func (*Kf) VcapServices ¶
VcapServices runs the vcap-services command.
func (*Kf) VerifyEchoLogsOutput ¶
func (k *Kf) VerifyEchoLogsOutput( ctx context.Context, appName string, expectedLogLine string, logOutput <-chan string, errs <-chan error, )
VerifyEchoLogsOutput verifies the expected output by tailing logs of an echo App.
func (*Kf) VerifyLogOutput ¶
func (k *Kf) VerifyLogOutput( ctx context.Context, appName string, expectedLogLine string, timeout time.Duration, extraArgs ...string, )
VerifyLogsOutput verifies the expected output by tailing logs of an echo App.
func (*Kf) VerifyTaskLogOutput ¶
func (k *Kf) VerifyTaskLogOutput( ctx context.Context, appName string, expectedLogLine string, timeout time.Duration, )
VerifyTaskLogOutput verifies the expected output by tailing logs of a task.
func (*Kf) WaitForCluster ¶
WaitForCluster runs doctor repeatedly until the cluster is ready or the operation times out.
func (*Kf) WithProxy ¶
WithProxy starts a proxy for an App and invokes the given function with its address. The proxy is closed when the function exits.
func (*Kf) WithProxyRoute ¶
WithProxyRoute starts a proxy for a route and invokes the given function with its address. The proxy is closed when the function exits.
type KfTestConfig ¶
KfTestConfig is a configuration for a Kf Test.
type KfTestOutput ¶
KfTestOutput is the output from `kf`. Note, this output is while kf is running.
type Metric ¶
type Metric interface {
// contains filtered or unexported methods
}
Metric is used with Write() to emit metrics.
type MetricLabels ¶
MetricLabels are used to store labels on metrics.
func MetricLabelsFromContext ¶
func MetricLabelsFromContext(ctx context.Context) MetricLabels
MetricLabelsFromContext returns MetricLabels from the Context. If there aren't any MetricLabels set, an empty MetricLabels object is returned.
type MetricLogger ¶
MetricLogger is used to write metrics. It is implemented by logging.Logger.
func MetricLoggerFromContext ¶
func MetricLoggerFromContext(ctx context.Context) MetricLogger
MetricLoggerFromContext returns a MetricLogger from the context that was set with ContextWithMetricLogger(). If one was never set, then a nil is returned.