integration

package
v2.11.26 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Package integration is a generated GoMock package.

Index

Examples

Constants

View Source
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"
)
View Source
const (
	AppCacheEnv = "APP_CACHE"
)

Variables

This section is empty.

Functions

func AppFromContext

func AppFromContext(ctx context.Context) string

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

func BrokerFromContext(ctx context.Context) string

BrokerFromContext returns the broker name given a context that has been setup via ContextWithBroker.

func CancelOnSignal

func CancelOnSignal(ctx context.Context, cancel func(), t *testing.T)

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

func CheckCluster(ctx context.Context, kf *Kf)

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 CheckSigtermApp(
	ctx context.Context,
	t *testing.T,
	kf *Kf,
	appName string,
)

func CombineOutput

func CombineOutput(ctx context.Context, t *testing.T, out KfTestOutput) <-chan string

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

func Compile(ctx context.Context, t *testing.T, codePath string) string

Compile compiles a path in the repo. It returns a path to the resulting binary. codePath must be relative to RootDir.

func CompileKf

func CompileKf(ctx context.Context, t *testing.T) string

CompileKf compiles the `kf` binary or the path set by PRE_COMPILED_KF_CLI. It returns a string to the resulting binary.

func ContextWithApp

func ContextWithApp(ctx context.Context, appName string) context.Context

ContextWithApp returns a context that has the App information. The App name can be fetched via AppFromContext.

func ContextWithBroker

func ContextWithBroker(ctx context.Context, brokerName string) context.Context

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

func ContextWithServiceClass(ctx context.Context, serviceClassName string) context.Context

ContextWithServiceClass returns a context that has the service class information. The service class name can be fetched via ServiceClassFromContext.

func ContextWithServiceInstance

func ContextWithServiceInstance(ctx context.Context, serviceInstanceName string) context.Context

ContextWithServiceInstance returns a context that has the service instance information. The service instance name can be fetched via ServiceInstanceFromContext.

func ContextWithServicePlan

func ContextWithServicePlan(ctx context.Context, servicePlanName string) context.Context

ContextWithServicePlan returns a context that has the service plan information. The service plan name can be fetched via ServiceInstanceFromContext.

func ContextWithSpace

func ContextWithSpace(ctx context.Context, space string) context.Context

ContextWithSpace returns a context that has the space information. The space can be fetched via SpaceFromContext.

func ContextWithStackdriverOutput

func ContextWithStackdriverOutput(ctx context.Context) context.Context

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

func CreateTempDir(ctx context.Context, t *testing.T) string

CreateTempDir returns a temp directory that will be cleaned up when the context finishes.

func DetachContext

func DetachContext(ctx context.Context) context.Context

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

func ExpectedAddr(hostname, urlPath string) string

ExpectedAddr returns the expected address for integration tests given a hostname and URL path.

func Logf

func Logf(t *testing.T, format string, i ...interface{})

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

func RootDir(ctx context.Context, t *testing.T) string

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

func RunKfTest(ctx context.Context, t *testing.T, test KfTest)

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

func ServiceClassFromContext(ctx context.Context) string

ServiceClassFromContext returns the service class name given a context that has been setup via ContextWithServiceClass.

func ServiceInstanceFromContext

func ServiceInstanceFromContext(ctx context.Context) string

ServiceInstanceFromContext returns the service instance name given a context that has been setup via ContextWithServiceInstance.

func ServicePlanFromContext

func ServicePlanFromContext(ctx context.Context) string

ServicePlanFromContext returns the service plan name given a context that has been setup via ContextWithServicePlan.

func ShouldSkipIntegration

func ShouldSkipIntegration(t *testing.T) bool

ShouldSkipIntegration returns true if integration tests are being skipped.

func SpaceFromContext

func SpaceFromContext(ctx context.Context) string

SpaceFromContext returns the space name given a context that has been setup via ContextWithSpace.

func StreamOutput

func StreamOutput(ctx context.Context, t *testing.T, out KfTestOutput, errs <-chan error)

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

func WithDynamicClient(ctx context.Context, t *testing.T, callback func(client dynamic.Interface))

WithDynamicClient creates a dynamic Kubernetes client from the config on the context and passes it to the callback.

func WithKubernetes

func WithKubernetes(ctx context.Context, t *testing.T, callback func(k8s *kubernetes.Clientset))

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

func WithRestConfig(ctx context.Context, t *testing.T, callback func(cfg *rest.Config))

WithRestConfig gets the rest config from the context and passes it to the callback.

func WithSpace

func WithSpace(ctx context.Context, t *testing.T, callback func(namespace string))

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

func WithWontFailContext(ctx context.Context) context.Context

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

func WriteMetric(ctx context.Context, m Metric)

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

EXPECT returns an object that allows the caller to indicate expected use.

func (*FakeMetricLogger) LogSync

func (m *FakeMetricLogger) LogSync(arg0 context.Context, arg1 logging.Entry) error

LogSync mocks base method.

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 JobInfo

type JobInfo struct {
	Name     string
	Schedule string
	Suspend  bool
}

JobInfo is the information returned by listed Jobs.

type Kf

type Kf struct {
	// contains filtered or unexported fields
}

Kf provides a DSL for running integration tests.

func NewKf

func NewKf(t *testing.T, binaryPath string) *Kf

NewKf creates a Kf for running tests with.

func (*Kf) App

func (k *Kf) App(ctx context.Context, name string) json.RawMessage

App gets a single App by name and returns its JSON representation.

func (*Kf) Apps

func (k *Kf) Apps(ctx context.Context) map[string]AppInfo

Apps returns all the Apps from `kf app`

func (*Kf) BindService

func (k *Kf) BindService(ctx context.Context, appName string, serviceInstanceName string, extraArgs ...string)

BindService runs the bind-service command.

func (*Kf) Bindings

func (k *Kf) Bindings(ctx context.Context, extraArgs ...string) []string

Bindings runs the services command.

func (*Kf) Buildpacks

func (k *Kf) Buildpacks(ctx context.Context) []string

Buildpacks runs the buildpacks command.

func (*Kf) CachePush

func (k *Kf) CachePush(ctx context.Context, appName, source string, args ...string) bool

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

func (k *Kf) CachePushV2(ctx context.Context, appName, source string, args ...string) bool

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

func (k *Kf) ConfigureSpace(ctx context.Context, extraArgs ...string) []string

ConfigureSpace runs any configure-space sub-command with the space configured on the context.

func (*Kf) CreateRoute

func (k *Kf) CreateRoute(ctx context.Context, domain string, extraArgs ...string)

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

func (k *Kf) CreateSpace(ctx context.Context) (string, []string)

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) Delete

func (k *Kf) Delete(ctx context.Context, appName string, extraArgs ...string)

Delete deletes an App.

func (*Kf) DeleteRoute

func (k *Kf) DeleteRoute(ctx context.Context, domain string, extraArgs ...string)

DeleteRoute runs the delete-route command.

func (*Kf) DeleteService

func (k *Kf) DeleteService(ctx context.Context, serviceInstanceName string, extraArgs ...string)

DeleteService runs the delete-service command.

func (*Kf) DeleteServiceBroker

func (k *Kf) DeleteServiceBroker(ctx context.Context, brokerName string, extraArgs ...string)

DeleteServiceBroker runs the delete-service-broker command.

func (*Kf) DeleteSpace

func (k *Kf) DeleteSpace(ctx context.Context, space string) []string

DeleteSpace runs the delete-space command. This command is run asynchronously since every test uses a unique space.

func (*Kf) Doctor

func (k *Kf) Doctor(ctx context.Context, extraArgs ...string)

Doctor runs the doctor command.

func (*Kf) Env

func (k *Kf) Env(ctx context.Context, appName string) map[string]string

Env displays the environment variables for an App.

func (*Kf) JobSchedules

func (k *Kf) JobSchedules(ctx context.Context, appName string) []JobInfo

func (*Kf) Jobs

func (k *Kf) Jobs(ctx context.Context, appName string) []JobInfo

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) MapRoute

func (k *Kf) MapRoute(ctx context.Context, appName, domain string, extraArgs ...string)

MapRoute runs the map-route command.

func (*Kf) Marketplace

func (k *Kf) Marketplace(ctx context.Context, extraArgs ...string) []string

Marketplace runs the marketplace command and returns the output.

func (*Kf) Push

func (k *Kf) Push(ctx context.Context, appName string, extraArgs ...string)

Push pushes an App.

func (*Kf) Restart

func (k *Kf) Restart(ctx context.Context, appName string)

Restart restarts an App.

func (*Kf) Routes

func (k *Kf) Routes(ctx context.Context) []string

Routes runs the routes command.

func (*Kf) RunCommand

func (k *Kf) RunCommand(ctx context.Context, cmd string, extraArgs ...string)

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) SSH

func (k *Kf) SSH(ctx context.Context, appName string, extraArgs ...string) []string

SSH runs a shell on an App.

func (*Kf) Scale

func (k *Kf) Scale(ctx context.Context, appName string, scale string)

Scale runs the scale command.

func (*Kf) Services

func (k *Kf) Services(ctx context.Context, extraArgs ...string) []string

Services runs the services command.

func (*Kf) SetEnv

func (k *Kf) SetEnv(ctx context.Context, appName, name, value string)

SetEnv sets the environment variable for an App.

func (*Kf) SpaceUsers

func (k *Kf) SpaceUsers(ctx context.Context) []SpaceUser

SpaceUsers returns a list of space users within the current space.

func (*Kf) Spaces

func (k *Kf) Spaces(ctx context.Context) []string

Spaces returns all the spaces from `kf spaces`

func (*Kf) Stacks

func (k *Kf) Stacks(ctx context.Context) []string

Stacks runs the stacks command.

func (*Kf) Start

func (k *Kf) Start(ctx context.Context, appName string)

Start starts an App.

func (*Kf) Stop

func (k *Kf) Stop(ctx context.Context, appName string)

Stop stops an App.

func (*Kf) Target

func (k *Kf) Target(ctx context.Context, namespace string) []string

Target runs the target command.

func (*Kf) Tasks

func (k *Kf) Tasks(ctx context.Context, appName string) []TaskInfo

Tasks runs the tasks command with given App name.

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

func (k *Kf) UnmapRoute(ctx context.Context, appName, domain string, extraArgs ...string)

UnmapRoute runs the unmap-route command.

func (*Kf) UnsetEnv

func (k *Kf) UnsetEnv(ctx context.Context, appName, name string)

UnsetEnv unsets the environment variable for an App.

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

func (k *Kf) VcapServices(ctx context.Context, extraArgs ...string) []byte

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

func (k *Kf) WaitForCluster(ctx context.Context)

WaitForCluster runs doctor repeatedly until the cluster is ready or the operation times out.

func (*Kf) WithProxy

func (k *Kf) WithProxy(ctx context.Context, appName string, f func(addr string))

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

func (k *Kf) WithProxyRoute(ctx context.Context, routeHost string, f func(addr string))

WithProxyRoute starts a proxy for a route and invokes the given function with its address. The proxy is closed when the function exits.

func (*Kf) WrapV2Buildpack

func (k *Kf) WrapV2Buildpack(ctx context.Context, buildpackName, v2URL string, extraArgs ...string)

WrapV2Buildpack runs the wrap-v2-buildpack command.

type KfTest

type KfTest func(ctx context.Context, t *testing.T, kf *Kf)

KfTest is a test ran by RunKfTest.

type KfTestConfig

type KfTestConfig struct {
	Args []string
	Env  map[string]string
	Dir  string
}

KfTestConfig is a configuration for a Kf Test.

type KfTestOutput

type KfTestOutput struct {
	Stdout io.Reader
	Stderr io.Reader
	Stdin  io.Writer
	Done   <-chan struct{}
}

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

type MetricLabels map[string]string

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

type MetricLogger interface {
	LogSync(ctx context.Context, e logging.Entry) error
}

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.

type SpaceUser

type SpaceUser struct {
	Name  string
	Kind  string
	Roles []string
}

SpaceUser is the information returned by listing space users.

type TaskInfo

type TaskInfo struct {
	Name        string
	ID          string
	DisplayName string
	Status      string
	Reason      string
}

TaskInfo is the information returned by listing tasks.

Jump to

Keyboard shortcuts

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