Documentation ¶
Index ¶
- Constants
- Variables
- func AddEmptyPaginatedResponse(server *ghttp.Server, path string)
- func AddFiftyOneOrgs(server *ghttp.Server)
- func AddFiftyOneSpaces(server *ghttp.Server)
- func AddHandler(ser *ghttp.Server, method string, pathAndQuery string, status int, body []byte)
- func AddLoginRoutes(s *Server)
- func AddMfa(server *Server, password string, mfaToken string)
- func AddOrReplaceEnvironment(env []string, newEnvName string, newEnvVal string) []string
- func AppGUID(appName string) string
- func AppJSON(appName string) string
- func BuildConfigurablePlugin(pluginType string, name string, version string, pluginCommands []PluginCommand) string
- func BuildTokenString(expiration time.Time) string
- func BuildpackGUIDByNameAndStack(buildpackName string, stackName string) string
- func BuildpackWithStack(f func(buildpackArchive string), stackName string)
- func BuildpackWithoutStack(f func(buildpackArchive string))
- func BuildpacksOutputRegex(fields BuildpackFields) string
- func CF(args ...string) *Session
- func CFWithEnv(envVars map[string]string, args ...string) *Session
- func CFWithStdin(stdin io.Reader, args ...string) *Session
- func CheckEnvironmentTargetedCorrectly(targetedOrganizationRequired bool, targetedSpaceRequired bool, testOrg string, ...)
- func CheckSpaceAndOrgTargetedCorrectly(command ...string)
- func ClearTarget()
- func ClientCredentialsTestMode() bool
- func ConfirmStagingLogs(session *Session)
- func ConvertPathToRegularExpression(path string) string
- func CreateAndTargetOrg() string
- func CreateCCV2Client() (*ccv2.Client, error)
- func CreateOrg(org string)
- func CreateOrgAndSpace(org string, space string)
- func CreateOrgAndSpaceUnlessExists(org string, space string)
- func CreateSpace(space string)
- func CreateStack(names ...string) string
- func CreateStackWithGUID() (string, string)
- func CreateUser() (string, string)
- func CreateUserInOrgRole(org, role string) (string, string)
- func CreateUserInSpaceRole(org, space, role string) (string, string)
- func Curl(obj interface{}, url string, props ...interface{})
- func CustomCF(cfEnv CFEnv, args ...string) *Session
- func DebugCustomCF(cfEnv CFEnv, args ...string) *Session
- func DefaultSharedDomain() string
- func DeleteBuildpackIfOnOldCCAPI(buildpackName string)
- func DeleteStack(name string)
- func DeleteUser(username string)
- func DestroyHomeDir(homeDir string)
- func DisableFeatureFlag(flagName string)
- func DomainName(prefix ...string) string
- func EnableFeatureFlag(flagName string)
- func EnsureMinimumNumberOfStacks(num int) []string
- func ExpiredAccessToken() string
- func FetchStacks() []string
- func FindOrCreateTCPRouterGroup(node int) string
- func GenerateHigherName(randomNameGenerator func() string, names ...string) string
- func GenerateLowerName(randomNameGenerator func() string, names ...string) string
- func GetAPI() string
- func GetAPIVersionV2() string
- func GetConfig() *configv3.Config
- func GetCredentials() (string, string)
- func GetFirstAppPackageGuid(appName string) string
- func GetIsolationSegmentGUID(name string) string
- func GetOrgGUID(orgName string) string
- func GetPRBuilderReporter() ginkgo.Reporter
- func GetSpaceGUID(spaceName string) string
- func InstallConfigurablePlugin(name string, version string, pluginCommands []PluginCommand)
- func InstallConfigurablePluginFailsUninstall(name string, version string, pluginCommands []PluginCommand)
- func IsUAAVersionAtLeast(minVersion string) bool
- func IsVersionMet(minVersion string) bool
- func IsWindows() bool
- func LoginAs(username, password string)
- func LoginCF() string
- func LoginCFWithClientCredentials() string
- func LogoutCF()
- func MakeBuildpackArchive(stackName string) string
- func ManagedServiceInstanceGUID(managedServiceInstanceName string) string
- func MapRouteToApplication(app string, domain string, host string, path string)
- func NewAppName() string
- func NewBuildpackName() string
- func NewDomainName(prefix ...string) string
- func NewHostName() string
- func NewIsolationSegmentName(infix ...string) string
- func NewOrgName() string
- func NewPassword() string
- func NewPath() string
- func NewPlanName() string
- func NewPluginRepositoryServer(pluginRepo PluginRepository) *Server
- func NewPluginRepositoryTLSServer(pluginRepo PluginRepository) *Server
- func NewSecurityGroupName(infix ...string) string
- func NewServiceBrokerName() string
- func NewServiceInstanceName() string
- func NewSpaceName() string
- func NewStackName() string
- func NewUsername() string
- func ParseTokenString(token string) jwt.JWT
- func PluginPlatform() string
- func PollLastOperationUntilSuccess(client *ccv2.Client, appName string, serviceInstanceName string)
- func PreferredStack() string
- func PrefixedRandomName(namePrefix string) string
- func QuickDeleteOrg(orgName string)
- func QuickDeleteOrgIfExists(orgName string)
- func QuickDeleteSpace(spaceName string)
- func QuotaName(name ...string) string
- func RandomName() string
- func RandomPort() int
- func SayPath(format string, path string) types.GomegaMatcher
- func SetAPI() (string, bool)
- func SetConfig(cb func(conf *configv3.Config))
- func SetConfigContent(dir string, rawConfig string)
- func SetHomeDir() string
- func SetOrgRole(username, org, role string)
- func SetSpaceRole(username, org, space, role string)
- func SetupBuildpackWithStack(buildpackName, stack string)
- func SetupBuildpackWithoutStack(buildpackName string)
- func SetupCF(org string, space string)
- func SetupCFWithGeneratedOrgAndSpaceNames() string
- func SetupReadOnlyOrgAndSpace() (string, string)
- func SetupSynchronizedSuite(setup func())
- func Sha1Sum(path string) string
- func SkipIfClientCredentialsNotSet() (string, string)
- func SkipIfClientCredentialsTestMode()
- func SkipIfCustomClientCredentialsNotSet() (string, string)
- func SkipIfNoRoutingAPI()
- func SkipIfOIDCCredentialsNotSet() (string, string)
- func SkipIfPrivateDockerInfoNotSet() (string, string, string)
- func SkipIfUAAVersionAtLeast(version string)
- func SkipIfUAAVersionLessThan(version string)
- func SkipIfV7()
- func SkipIfV7AndVersionLessThan(minVersion string)
- func SkipIfVersionAtLeast(maxVersion string)
- func SkipIfVersionLessThan(minVersion string)
- func SkipIfWindows()
- func StartAndTargetMockServerWithAPIVersions(v2Version string, v3Version string) *Server
- func StartMockServerWithAPIVersions(v2Version string, v3Version string) *Server
- func StartMockServerWithMinimumCLIVersion(minCLIVersion string) *Server
- func SwitchToNoRole() string
- func SwitchToOrgRole(org, role string) string
- func SwitchToSpaceRole(org, space, role string) string
- func TargetOrg(org string)
- func TargetOrgAndSpace(org string, space string)
- func TempDirAbsolutePath(dir string, prefix string) string
- func TempFileAbsolutePath(dir string, pattern string) *os.File
- func TempFileWithContent(contents string) string
- func TurnOffColors()
- func TurnOffExperimental()
- func TurnOffExperimentalLogin()
- func TurnOnExperimental()
- func TurnOnExperimentalLogin()
- func UnmapRouteFromApplication(app string, domain string, host string, path string)
- func UnrefactoredCheckEnvironmentTargetedCorrectly(targetedOrganizationRequired bool, targetedSpaceRequired bool, testOrg string, ...)
- func UnsetAPI()
- func UserProvidedServiceInstanceGUID(userProvidedServiceInstanceName string) string
- func VerifyAppPackageContentsV2(appName string, files ...string)
- func VerifyAppPackageContentsV3(appName string, files ...string)
- func WithBananaPantsApp(f func(dir string))
- func WithCrashingApp(f func(dir string))
- func WithEmptyFilesApp(f func(dir string))
- func WithHelloWorldApp(f func(dir string))
- func WithMultiBuildpackApp(f func(dir string))
- func WithMultiEndpointApp(f func(dir string))
- func WithNoResourceMatchedApp(f func(dir string))
- func WithProcfileApp(f func(dir string))
- func WithRandomHomeDir(action func())
- func WriteCommand(workingDir string, env map[string]string, args []string)
- func WriteFailureSummary(outputRoot, filename string)
- func WriteManifest(path string, manifest map[string]interface{})
- func Zipit(source, target, prefix string) error
- type AppInstanceRow
- type AppProcessTable
- type AppTable
- type Binary
- type Buildpack
- type BuildpackFields
- type BuildpackList
- type CFEnv
- type Domain
- type PRBuilderReporter
- func (reporter *PRBuilderReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary)
- func (reporter *PRBuilderReporter) BeforeSuiteDidRun(setupSummary *types.SetupSummary)
- func (reporter *PRBuilderReporter) SpecDidComplete(specSummary *types.SpecSummary)
- func (reporter *PRBuilderReporter) SpecSuiteDidEnd(summary *types.SuiteSummary)
- func (reporter *PRBuilderReporter) SpecSuiteWillBegin(conf config.GinkgoConfigType, summary *types.SuiteSummary)
- func (reporter *PRBuilderReporter) SpecWillRun(specSummary *types.SpecSummary)
- type Plugin
- type PluginCommand
- type PluginRepository
- type PluginRepositoryServerWithPlugin
- func (pluginRepoServer *PluginRepositoryServerWithPlugin) Cleanup()
- func (pluginRepoServer *PluginRepositoryServerWithPlugin) Init(pluginName string, version string, platform string, ...)
- func (pluginRepoServer *PluginRepositoryServerWithPlugin) PluginSize() int64
- func (pluginRepoServer *PluginRepositoryServerWithPlugin) URL() string
- type Route
- type SecurityGroup
- type ServiceInstanceGUID
- type UAAVersion
- type User
Examples ¶
Constants ¶
const ( DebugCommandPrefix = "\nCMD>" DebugCommandPrefixWithDir = "\nCMD %s>" DebugOutPrefix = "OUT: " DebugErrPrefix = "ERR: " )
const ( GUIDRegex = `[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}` ISO8601Regex = `\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{1,3}[+-]\d{4}` StaticfileBuildpackStartCommand = `\$HOME/boot.sh|sh boot.sh` ModernStaticfileBuildpackStartCommand = `$HOME/boot.sh` ModernStaticfileBuildpackStartCommandRegex = `\$HOME/boot\.sh` UserFriendlyDateRegex = `[A-Z][a-z]{2} \d{2} [A-Z][a-z]{2} \d{2}:\d{2}:\d{2} [A-Z]+ \d{4}` )
const ( DefaultV2Version string = "2.131.0" DefaultV3Version string = "3.66.0" )
const MaxTestPort = 1034
MaxTestPort should be defined by the CF router group for integration tests.
const MinTestPort = 1024
MinTestPort should be defined by the CF router group for integration tests.
const (
PRBuilderOutputEnvVar = "PR_BUILDER_OUTPUT_DIR"
)
const ReadableDateTimeRegex = `\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3,5} \d{4}`
const V7 = false
Variables ¶
var CcRootCache *ccRoot
CcRootCache is a pointer to a cache of the CC root response
Functions ¶
func AddEmptyPaginatedResponse ¶
AddEmptyPaginatedResponse adds a mock handler to the given server which returns a response with no resources.
func AddFiftyOneOrgs ¶
AddFiftyOneOrgs adds a mock handler to the given server which returns 51 orgs on GET requests to /v3/organizations?order_by=name. It also paginates, so page 2 can be requested with /v3/organizations?page=2&per_page=50.
func AddFiftyOneSpaces ¶
AddFiftyOneSpaces adds mock handlers to the given http server which includes an organization which will contain 51 spaces
func AddHandler ¶
AddHandler adds a mock handler to the server making a request specified by "method" to the endpoint specified by "pathAndQuery", returning a response with status code "status" and response body "body".
func AddLoginRoutes ¶
func AddLoginRoutes(s *Server)
AddLoginRoutes adds a mock handler to the given server which returns an access token and a 200 status code on POST requests to /oauth/token.
func AddMfa ¶
AddMfa adds a mock handler to the given server which returns a login response and a 200 status code on GET requests to the /login endpoint. It adds another mock handler to validate the given password and MFA token upon POST requests to /oauth/token.
func AddOrReplaceEnvironment ¶
AddOrReplaceEnvironment will update environment if it already exists or will add a new environment with the given environment name and details.
func BuildConfigurablePlugin ¶
func BuildConfigurablePlugin(pluginType string, name string, version string, pluginCommands []PluginCommand) string
BuildConfigurablePlugin builds a plugin of type pluginType from the integration/assets/<pluginType> directory with the given name, version, and commands. Available pluginTypes: configurable_plugin, configurable_plugin_fails_uninstall, test_plugin, test_plugin_fails_metadata, test_plugin_with_command_overrides, test_plugin_with_panic.
func BuildTokenString ¶
BuildTokenString returns a string typed JSON web token with the specified expiration time
func BuildpackWithStack ¶
BuildpackWithStack makes a simple buildpack for the given stack (using MakeBuildpackArchive) and yields it to the given function, removing the zip at the end.
func BuildpackWithoutStack ¶
func BuildpackWithoutStack(f func(buildpackArchive string))
BuildpackWithoutStack makes a simple buildpack without a stack (using MakeBuildpackArchive) and yields it to the given function, removing the zip at the end.
func BuildpacksOutputRegex ¶
func BuildpacksOutputRegex(fields BuildpackFields) string
BuildpacksOutputRegex takes a BuildpackFields struct and returns a regex matching a line in the output of 'cf buildpacks' representing the given buildpack.
func CFWithEnv ¶
CFWithEnv runs a 'cf' command with specified environment variables and given arguments.
func CFWithStdin ¶
CFWithStdin runs a 'cf' command with a custom stdin and given arguments.
func CheckEnvironmentTargetedCorrectly ¶
func CheckEnvironmentTargetedCorrectly(targetedOrganizationRequired bool, targetedSpaceRequired bool, testOrg string, command ...string)
CheckEnvironmentTargetedCorrectly will confirm if the command requires an API to be targeted and logged in to run. It can optionally check if the command requires org and space to be targeted.
func CheckSpaceAndOrgTargetedCorrectly ¶
func CheckSpaceAndOrgTargetedCorrectly(command ...string)
func ClearTarget ¶
func ClearTarget()
ClearTarget logs out and logs back in to the CLI using LogoutCF and LoginCF.
func ClientCredentialsTestMode ¶
func ClientCredentialsTestMode() bool
func ConfirmStagingLogs ¶
func ConfirmStagingLogs(session *Session)
ConfirmStagingLogs checks session for output from NOAA client indicating that staging is working.
func ConvertPathToRegularExpression ¶
ConvertPathToRegularExpression converts a windows file path into a string which may be embedded in a ginkgo-compatible regular expression.
func CreateAndTargetOrg ¶
func CreateAndTargetOrg() string
CreateAndTargetOrg creates a randomly-named org and targets it.
func CreateCCV2Client ¶
CreateCCV2Client constructs a client object able to communicate with the cloudcontroller V2 API.
func CreateOrg ¶
func CreateOrg(org string)
CreateOrg creates an org with the given name using 'cf create-org'.
func CreateOrgAndSpace ¶
CreateOrgAndSpace creates an org and a space in that org with specified names.
func CreateOrgAndSpaceUnlessExists ¶
CreateOrgAndSpaceUnlessExists creates an org and a space in that org with specified names only if these don't exist yet.
func CreateSpace ¶
func CreateSpace(space string)
CreateSpace creates a space with the given name using 'cf create-space'.
func CreateStack ¶
CreateStack creates a new stack with the user provided name. If a name is not provided, a random name is used
func CreateStackWithGUID ¶
CreateStackWithGUID creates a stack with a random name and returns its name and guid
func CreateUser ¶
CreateUser creates a user with a random username and password and returns both.
func CreateUserInOrgRole ¶
CreateUserInOrgRole creates a user with a random username and password and gives them the specified role within a specific org. The new user's username and password are returned.
func CreateUserInSpaceRole ¶
CreateUserInSpaceRole creates a user with a random username and password and gives them the specified role within a specific space. The new user's username and password are returned.
func Curl ¶
func Curl(obj interface{}, url string, props ...interface{})
Curl runs a 'cf curl' command with a URL format string, allowing props to be interpolated into the URL string with fmt.Sprintf. The JSON response is unmarshaled into given obj.
func DebugCustomCF ¶
DebugCustomCF runs a 'cf' command with a custom environment and given arguments, with CF_LOG_LEVEL set to 'debug'.
func DefaultSharedDomain ¶
func DefaultSharedDomain() string
DefaultSharedDomain runs 'cf domains' to find the default domain, caching the result so that the same domain is returned each time it is called.
func DeleteBuildpackIfOnOldCCAPI ¶
func DeleteBuildpackIfOnOldCCAPI(buildpackName string)
DeleteBuildpackIfOnOldCCAPI deletes the buildpack if the CC API targeted by the current test run is <= 2.80.0. Before this version, some entities would receive and invalid next_url in paginated requests. Since our test run now generally creates more than 50 buildpacks, we need to delete test buildpacks after use if we are targeting and older CC API. see https://github.com/cloudfoundry/capi-release/releases/tag/1.45.0
func DeleteUser ¶
func DeleteUser(username string)
DeleteUser deletes the user specified by username.
func DestroyHomeDir ¶
func DestroyHomeDir(homeDir string)
DestroyHomeDir safely removes the given directory checking for errors.
func DisableFeatureFlag ¶
func DisableFeatureFlag(flagName string)
DisableFeatureFlag disables given feature flag with 'cf disable-feature-flag'.
func DomainName ¶
DomainName returns a random domain name, with a given prefix if provided.
func EnableFeatureFlag ¶
func EnableFeatureFlag(flagName string)
EnableFeatureFlag enables given feature flag with 'cf enable-feature-flag'.
func EnsureMinimumNumberOfStacks ¶
EnsureMinimumNumberOfStacks ensures there are at least <num> stacks in the foundation by creating new ones if there are fewer than the specified number
func ExpiredAccessToken ¶
func ExpiredAccessToken() string
ExpiredAccessToken returns an example expired bearer token.
func FetchStacks ¶
func FetchStacks() []string
FetchStacks returns all the stack names present in the foundation.
func FindOrCreateTCPRouterGroup ¶
FindOrCreateTCPRouterGroup uses the routing API to find a router group with name INTEGRATION-TCP-NODE-<node>, or create one if it does not exist. Returns the name of the router group.
func GenerateHigherName ¶
GenerateHigherName will use the passed randomNameGenerator to generate a name with a higher sort value than all the passed names
func GenerateLowerName ¶
GenerateLowerName will use the passed randomNameGenerator to generate a name with a lower sort value than all the passed names
func GetAPI ¶
func GetAPI() string
GetAPI gets the value of the CF_INT_API environment variable, if set, and prefixes it with "https://" if the value doesn't already start with "http". If the variable is not set, returns "https://api.bosh-lite.com".
func GetAPIVersionV2 ¶
func GetAPIVersionV2() string
GetAPIVersionV2 returns the V2 api version of the targeted API
func GetCredentials ¶
GetCredentials returns back the credentials for the user or client to authenticate with Cloud Foundry.
func GetFirstAppPackageGuid ¶
func GetIsolationSegmentGUID ¶
GetIsolationSegmentGUID gets the Isolation Segment GUID by passing along the given isolation segment name as a query parameter in the /v3/isolation_segments?names=name endpoint.
func GetOrgGUID ¶
GetOrgGUID gets the GUID of an org with the given name.
func GetPRBuilderReporter ¶
func GetSpaceGUID ¶
GetSpaceGUID gets the GUID of a space with the given name.
func InstallConfigurablePlugin ¶
func InstallConfigurablePlugin(name string, version string, pluginCommands []PluginCommand)
InstallConfigurablePlugin builds and installs a plugin called 'configurable_plugin' with the given name, version, and commands.
func InstallConfigurablePluginFailsUninstall ¶
func InstallConfigurablePluginFailsUninstall(name string, version string, pluginCommands []PluginCommand)
InstallConfigurablePluginFailsUninstall builds and installs a plugin called 'configurable_plugin_fails_uninstall' with the given name, version, and commands.
func IsUAAVersionAtLeast ¶
IsUAAVersionAtLeast returns true if the UAA version >= minVersion, false otherwise.
func IsVersionMet ¶
IsVersionMet verifies the targeted API meets the minimum required version
func LoginAs ¶
func LoginAs(username, password string)
LoginAs logs in to the CLI with 'cf auth' and the given username and password, retrying up to 3 times on failures.
func LoginCF ¶
func LoginCF() string
LoginCF logs in to the CLI using the username and password from the CF_INT_USERNAME and CF_INT_PASSWORD environment variables, respectively, defaulting to "admin" for each if either is not set.
func LoginCFWithClientCredentials ¶
func LoginCFWithClientCredentials() string
LoginCFWithClientCredentials logs in to the CLI using client credentials from the CF_INT_CLIENT_ID and CF_INT_CLIENT_SECRET environment variables and returns the client ID. If these environment variables are not set, it skips the current test.
func MakeBuildpackArchive ¶
MakeBuildpackArchive makes a simple buildpack zip for a given stack.
func ManagedServiceInstanceGUID ¶
ManagedServiceInstanceGUID returns the GUID for a managed service instance.
func MapRouteToApplication ¶
MapRouteToApplication maps a route to an app using 'cf map-route' and asserts that the mapping exists.
func NewAppName ¶
func NewAppName() string
NewAppName provides a random name prefixed with INTEGRATION-APP
func NewBuildpackName ¶
func NewBuildpackName() string
NewBuildpackName provides a random name prefixed with INTEGRATION-BUILDPACK
func NewDomainName ¶
NewDomainName provides a random domain name prefixed with integration. If prefix is provided the domain name will have structure "integration-prefix-randomstring.com" else it will have structure "integration-randomstring.com"
func NewIsolationSegmentName ¶
NewIsolationSegmentName provides a random name prefixed with INTEGRATION-ISOLATION-SEGMENT
func NewOrgName ¶
func NewOrgName() string
NewOrgName provides a random name prefixed with INTEGRATION-ORG
func NewPassword ¶
func NewPassword() string
NewPassword provides a random string prefixed with INTEGRATION-PASSWORD
func NewPlanName ¶
func NewPlanName() string
NewPlanName provides a random name prefixed with INTEGRATION-PLAN
func NewPluginRepositoryServer ¶
func NewPluginRepositoryServer(pluginRepo PluginRepository) *Server
NewPluginRepositoryServer is used to configure and start a new plugin repo server, exposing the plugins contained in the pluginRepo.
func NewPluginRepositoryTLSServer ¶
func NewPluginRepositoryTLSServer(pluginRepo PluginRepository) *Server
NewPluginRepositoryTLSServer is used to configure and start a new TLS plugin repo server, exposing the plugins contained in the pluginRepo.
func NewSecurityGroupName ¶
NewSecurityGroupName provides a random name prefixed with INTEGRATION-SEC-GROUP. If an infix is provided, it is placed between INTEGRATION-SEC-GROUP and the random string.
func NewServiceBrokerName ¶
func NewServiceBrokerName() string
NewServiceBrokerName provides a random name prefixed with INTEGRATION-SERVICE-BROKER
func NewServiceInstanceName ¶
func NewServiceInstanceName() string
NewServiceInstanceName provides a random name prefixed with INT-SI
func NewSpaceName ¶
func NewSpaceName() string
NewSpaceName provides a random name prefixed with INTEGRATION-SPACE
func NewStackName ¶
func NewStackName() string
NewStackName provides a random name prefixed with INTEGRATION-STACK
func NewUsername ¶
func NewUsername() string
NewUsername provides a random name prefixed with INTEGRATION-USER
func ParseTokenString ¶
ParseTokenString takes a string typed token and returns a jwt.JWT struct representation of that token
func PluginPlatform ¶
func PluginPlatform() string
PluginPlatform returns the platform string for Unix.
func PollLastOperationUntilSuccess ¶
PollLastOperationUntilSuccess polls the last operation performed on a service instance bound to a given app until success. An expectation will fail if the last operation does not succeed or polling takes over 5 minutes.
func PreferredStack ¶
func PreferredStack() string
PreferredStack returns the cflinuxfs3 stack name if it present, otherwise cflinuxfs2 is returned.
func PrefixedRandomName ¶
PrefixedRandomName provides a random name with structure "namePrefix-randomstring"
func QuickDeleteOrg ¶
func QuickDeleteOrg(orgName string)
QuickDeleteOrg deletes the org with the given name, if provided, using 'cf curl /v2/organizations... -X DELETE'.
func QuickDeleteOrgIfExists ¶
func QuickDeleteOrgIfExists(orgName string)
QuickDeleteOrgIfExists deletes the org with the given name, if it exists, using 'cf curl /v2/organizations... -X DELETE'.
func QuickDeleteSpace ¶
func QuickDeleteSpace(spaceName string)
QuickDeleteSpace deletes the space with the given name, if it exists, using 'cf curl /v2/spaces... -X DELETE'.
func QuotaName ¶
QuotaName provides a random name prefixed with INTEGRATION-QUOTA. If given a name, it structures the name like INTEGRATION-QUOTA-name-randomstring.
func RandomPort ¶
func RandomPort() int
RandomPort returns a port number that has not yet been used, starting at 1024 and increasing by one each time it is called. It errors if the number increases above 1123.
func SayPath ¶
func SayPath(format string, path string) types.GomegaMatcher
SayPath is used to assert that a path is printed within streaming output. On Windows, it uses a case-insensitive match and escapes the path.
func SetAPI ¶
SetAPI sets the API endpoint to the value of the CF_INT_API environment variable, or "https://api.bosh-lite.com" if not set. If the SKIP_SSL_VALIDATION environment variable is set, it will use the '--skip-ssl-validation' flag. It returns the API URL and a boolean indicating if SSL validation was skipped.
func SetConfig ¶
SetConfig allows for a given function to modify a CF config JSON and writes the result back down to the filesystem.
func SetConfigContent ¶
SetConfigContent writes given raw config into given directory as "config.json".
func SetHomeDir ¶
func SetHomeDir() string
SetHomeDir sets CF_HOME and CF_PLUGIN_HOME to a temp directory and outputs the created directory through GinkgoWriter.
func SetOrgRole ¶
func SetOrgRole(username, org, role string)
SetUserAsOrgDeveloper sets the user as a org developer with `cf set-org-role`.
func SetSpaceRole ¶
func SetSpaceRole(username, org, space, role string)
SetUserAsSpaceDeveloper sets the user as a space developer with `cf set-space-role`.
func SetupBuildpackWithStack ¶
func SetupBuildpackWithStack(buildpackName, stack string)
SetupBuildpackWithStack makes and uploads a buildpack for the given stack.
func SetupBuildpackWithoutStack ¶
func SetupBuildpackWithoutStack(buildpackName string)
SetupBuildpackWithoutStack makes and uploads a buildpack without a stack.
func SetupCF ¶
SetupCF logs in to the CLI with LoginCF, creates the given org and space, and targets that org and space.
func SetupCFWithGeneratedOrgAndSpaceNames ¶
func SetupCFWithGeneratedOrgAndSpaceNames() string
SetupCFWithGeneratedOrgAndSpaceNames logs in to the CLI with LoginCF, creates the org and space with generated names, and targets that org and space. Returns the generated org so that it can be deleted easily in cleanup step of the test.
func SetupReadOnlyOrgAndSpace ¶
SetupReadOnlyOrgAndSpace creates a randomly-named org containing two randomly-named spaces. It creates a new CF_HOME directory to run these commands, then deletes it afterwards.
func SetupSynchronizedSuite ¶
func SetupSynchronizedSuite(setup func())
SetupSynchronizedSuite runs a setup function in its own CF context, creating and destroying a home directory around it.
func SkipIfClientCredentialsNotSet ¶
SkipIfClientCredentialsNotSet will skip the test when either CF_INT_CLIENT_ID or CF_INT_CLIENT_SECRET are not set.
func SkipIfClientCredentialsTestMode ¶
func SkipIfClientCredentialsTestMode()
func SkipIfCustomClientCredentialsNotSet ¶
SkipIfCustomClientCredentialsNotSet will skip the test when either CF_INT_CUSTOM_CLIENT_ID or CF_INT_CUSTOM_CLIENT_SECRET are not set.
func SkipIfNoRoutingAPI ¶
func SkipIfNoRoutingAPI()
SkipIfNoRoutingAPI is used to skip tests if the routing API is not present
func SkipIfOIDCCredentialsNotSet ¶
SkipIfOIDCCredentialsNotSet returns back the username and the password for OIDC origin, or skips the test if those values are not set.
func SkipIfPrivateDockerInfoNotSet ¶
SkipIfPrivateDockerInfoNotSet skips the test if CF_INT_DOCKER_IMAGE, CF_INT_DOCKER_USERNAME, or CF_INT_DOCKER_PASSWORD environment variables are not defined.
func SkipIfUAAVersionAtLeast ¶
func SkipIfUAAVersionAtLeast(version string)
SkipIfUAAVersionAtLeast is used to skip tests if the UAA varsion >= the specified version.
func SkipIfUAAVersionLessThan ¶
func SkipIfUAAVersionLessThan(version string)
SkipIfUAAVersionLessThan is used to skip tests if the UAA version is < the specified version
func SkipIfV7AndVersionLessThan ¶
func SkipIfV7AndVersionLessThan(minVersion string)
SkipIfV7AndVersionLessThan is used to skip tests if the target build is V7 and API version < the specified version If minVersion contains the prefix 3 then the v3 version is checked, otherwise the v2 version is used.
func SkipIfVersionAtLeast ¶
func SkipIfVersionAtLeast(maxVersion string)
SkipIfVersionLessThan is used to skip tests if the the API version >= the specified version. If maxVersion contains the prefix 3 then the v3 version is checked, otherwise the v2 version is used.
func SkipIfVersionLessThan ¶
func SkipIfVersionLessThan(minVersion string)
SkipIfVersionLessThan is used to skip tests if the the API version < the specified version. If minVersion contains the prefix 3 then the v3 version is checked, otherwise the v2 version is used.
func SkipIfWindows ¶
func SkipIfWindows()
func StartAndTargetMockServerWithAPIVersions ¶
StartAndTargetMockServerWithAPIVersions starts and targets a server with the given V2 and V3 API versions.
func StartMockServerWithAPIVersions ¶
StartMockServerWithAPIVersions starts a server with the given V2 and V3 API versions
func StartMockServerWithMinimumCLIVersion ¶
func StartMockServerWithMinimumCLIVersion(minCLIVersion string) *Server
StartMockServerWithMinimumCLIVersion starts a server with the default V2 and V3 API versions and the given minimum CLI version.
func SwitchToNoRole ¶
func SwitchToNoRole() string
SwitchToNoRole logs out of the CLI and logs back in as a newly-created user without a role.
func SwitchToOrgRole ¶
SwitchToOrgRole logs out of the CLI and logs back in as a newly-created user with the given org role in the given org.
func SwitchToSpaceRole ¶
SwitchToSpaceRole logs out of the CLI and logs back in as a newly-created user with the given space role in the given space and org.
func TargetOrgAndSpace ¶
TargetOrgAndSpace targets the given org and space with 'cf target'.
func TempDirAbsolutePath ¶
TempDirAbsolutePath wraps `ioutil.TempDir`, ensuring symlinks are expanded before returning the path
func TempFileAbsolutePath ¶
TempFileAbsolutePath wraps `ioutil.TempFile`, ensuring symlinks are expanded before returning the path
func TempFileWithContent ¶
TempFileWithContent writes a temp file with given content and return the file name.
func TurnOffExperimental ¶
func TurnOffExperimental()
TurnOffExperimental unsets CF_CLI_EXPERIMENTAL.
func TurnOffExperimentalLogin ¶
func TurnOffExperimentalLogin()
TurnOffExperimentalLogin unsets CF_EXPERIMENTAL_LOGIN.
func TurnOnExperimental ¶
func TurnOnExperimental()
TurnOnExperimental sets CF_CLI_EXPERIMENTAL to 'true'.
func TurnOnExperimentalLogin ¶
func TurnOnExperimentalLogin()
TurnOnExperimentalLogin sets CF_EXPERIMENTAL_LOGIN to 'true'.
func UnmapRouteFromApplication ¶
UnmapRouteFromApplication unmaps a route from an app using 'cf unmap-route' and asserts that the mapping gets deleted.
func UnrefactoredCheckEnvironmentTargetedCorrectly ¶
func UnrefactoredCheckEnvironmentTargetedCorrectly(targetedOrganizationRequired bool, targetedSpaceRequired bool, testOrg string, command ...string)
UnrefactoredCheckEnvironmentTargetedCorrectly will confirm if the command requires an API to be targeted and logged in to run. It can optionally check if the command requires org and space to be targeted.
func UserProvidedServiceInstanceGUID ¶
UserProvidedServiceInstanceGUID returns the GUID for a user provided service instance.
func VerifyAppPackageContentsV2 ¶
VerifyAppPackageContentsV2 verifies the contents of a V2 app package by downloading the package zip and verifying the zipped files match the passed files.
func VerifyAppPackageContentsV3 ¶
VerifyAppPackageContentsV3 verifies the contents of a V3 app package by downloading the package zip and verifying the zipped files match the passed files.
func WithBananaPantsApp ¶
func WithBananaPantsApp(f func(dir string))
WithBananaPantsApp creates a simple application to use with your CLI command (typically CF Push). When pushing, be aware of specifying '-b staticfile_buildpack" so that your app will correctly start up with the proper buildpack.
func WithCrashingApp ¶
func WithCrashingApp(f func(dir string))
WithCrashingApp creates an application to use with your CLI command that will not successfully start its `web` process
func WithEmptyFilesApp ¶
func WithEmptyFilesApp(f func(dir string))
func WithHelloWorldApp ¶
func WithHelloWorldApp(f func(dir string))
WithHelloWorldApp creates a simple application to use with your CLI command (typically CF Push). When pushing, be aware of specifying '-b staticfile_buildpack" so that your app will correctly start up with the proper buildpack.
Example ¶
var appName string When("the app exists", func() { BeforeEach(func() { appName = helpers.PrefixedRandomName("app") helpers.WithHelloWorldApp(func(appDir string) { Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, "push", appName)).Should(Exit(0)) }) }) })
Output:
func WithMultiBuildpackApp ¶
func WithMultiBuildpackApp(f func(dir string))
WithMultiBuildpackApp creates a multi-buildpack application to use with the CF push command.
func WithMultiEndpointApp ¶
func WithMultiEndpointApp(f func(dir string))
WithMultiEndpointApp creates a simple application to use with your CLI command (typically CF Push). It has multiple endpoints which are helpful when testing http healthchecks.
func WithNoResourceMatchedApp ¶
func WithNoResourceMatchedApp(f func(dir string))
WithNoResourceMatchedApp creates a simple application to use with your CLI command (typically CF Push). When pushing, be aware of specifying '-b staticfile_buildpack" so that your app will correctly start up with the proper buildpack.
func WithProcfileApp ¶
func WithProcfileApp(f func(dir string))
WithProcfileApp creates an application to use with your CLI command that contains Procfile defining web and worker processes.
func WithRandomHomeDir ¶
func WithRandomHomeDir(action func())
WithRandomHomeDir sets CF_HOME and CF_PLUGIN_HOME to a temp directory and outputs the created directory through GinkgoWriter. Then it executes the provided function 'action'. Finally, it’s restoring the previous CF_HOME and CF_PLUGIN_HOME.
func WriteCommand ¶
WriteCommand prints the working directory, the environment variables, and 'cf' with the given arguments. Environment variables that are passwords will be redacted.
func WriteFailureSummary ¶
func WriteFailureSummary(outputRoot, filename string)
WriteFailureSummary aggregates test failures from all parallel nodes, sorts them, and writes the result to a file.
func WriteManifest ¶
WriteManifest will write out a YAML manifest file at the specified path.
Types ¶
type AppInstanceRow ¶
type AppInstanceRow struct { Index string State string Since string CPU string Memory string Disk string Details string }
AppInstanceRow represents an instance of a V3 app's process, as displayed in the 'cf app' output.
type AppProcessTable ¶
type AppProcessTable struct { Type string InstanceCount string MemUsage string Instances []AppInstanceRow }
AppProcessTable represents a process of a V3 app, as displayed in the 'cf app' output.
type AppTable ¶
type AppTable struct {
Processes []AppProcessTable
}
AppTable represents a V3 app as a collection of processes, as displayed in the 'cf app' output.
func ParseV3AppProcessTable ¶
ParseV3AppProcessTable parses bytes from 'cf app' stdout into an AppTable.
type Binary ¶
type Binary struct { Checksum string `json:"checksum"` Platform string `json:"platform"` URL string `json:"url"` }
Binary represents the metadata need to retrieve one of the binaries that makes up a plugin.
type BuildpackFields ¶
type BuildpackFields struct { Position string Name string Enabled string Locked string Filename string Stack string }
BuildpackFields represents a buildpack, displayed in the 'cf buildpacks' command.
type BuildpackList ¶
type BuildpackList struct {
Buildpacks []Buildpack `json:"resources"`
}
type CFEnv ¶
type CFEnv struct { WorkingDirectory string EnvVars map[string]string // contains filtered or unexported fields }
CFEnv represents configuration for running a 'cf' command. It allows us to run a 'cf' command with a custom working directory, specific environment variables, and stdin.
type Domain ¶
Domain represents a domain scoped to an organization.
func (Domain) Create ¶
func (d Domain) Create()
Create uses 'cf create-domain' to create the domain in org d.Org with name d.Name.
func (Domain) CreateInternal ¶
func (d Domain) CreateInternal()
CreateInternal uses 'cf create-shared-domain' to create an shared, internal domain with name d.Name.
func (Domain) CreatePrivate ¶
func (d Domain) CreatePrivate()
CreatePrivate uses 'cf create-private-domain' to create the domain in org d.Org with name d.Name.
func (Domain) CreateShared ¶
func (d Domain) CreateShared()
CreateShared uses 'cf create-shared-domain' to create an shared domain with name d.Name.
func (Domain) CreateWithRouterGroup ¶
CreateWithRouterGroup uses 'cf create-shared-domain' to create a shared domain with name d.Name and given router group.
func (Domain) Delete ¶
func (d Domain) Delete()
Delete uses 'cf delete-domain' to delete the domain without asking for confirmation.
func (Domain) DeleteShared ¶
func (d Domain) DeleteShared()
DeleteShared uses 'cf delete-shared-domain' to delete the shared domain without asking for confirmation.
type PRBuilderReporter ¶
type PRBuilderReporter struct {
// contains filtered or unexported fields
}
func NewPRBuilderReporter ¶
func NewPRBuilderReporter(outputDir string) *PRBuilderReporter
func (*PRBuilderReporter) AfterSuiteDidRun ¶
func (reporter *PRBuilderReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary)
func (*PRBuilderReporter) BeforeSuiteDidRun ¶
func (reporter *PRBuilderReporter) BeforeSuiteDidRun(setupSummary *types.SetupSummary)
func (*PRBuilderReporter) SpecDidComplete ¶
func (reporter *PRBuilderReporter) SpecDidComplete(specSummary *types.SpecSummary)
func (*PRBuilderReporter) SpecSuiteDidEnd ¶
func (reporter *PRBuilderReporter) SpecSuiteDidEnd(summary *types.SuiteSummary)
func (*PRBuilderReporter) SpecSuiteWillBegin ¶
func (reporter *PRBuilderReporter) SpecSuiteWillBegin(conf config.GinkgoConfigType, summary *types.SuiteSummary)
func (*PRBuilderReporter) SpecWillRun ¶
func (reporter *PRBuilderReporter) SpecWillRun(specSummary *types.SpecSummary)
type Plugin ¶
type Plugin struct { Name string `json:"name"` Version string `json:"version"` Binaries []Binary `json:"binaries"` }
Plugin represents a plugin object provided by a plugin repo.
type PluginCommand ¶
PluginCommand represents metadata for a CLI plugin command.
type PluginRepository ¶
type PluginRepository struct {
Plugins []Plugin `json:"plugins"`
}
PluginRepository represents a repo response object describing a list of plugins available.
type PluginRepositoryServerWithPlugin ¶
type PluginRepositoryServerWithPlugin struct {
// contains filtered or unexported fields
}
PluginRepositoryServerWithPlugin represents a server used to provide downloadable plugins.
func NewPluginRepositoryServerWithPlugin ¶
func NewPluginRepositoryServerWithPlugin(pluginName string, version string, platform string, shouldCalculateChecksum bool) *PluginRepositoryServerWithPlugin
NewPluginRepositoryServerWithPlugin is used to create a server to provide a single configurable_plugin with user provided name, version, and platform.
func (*PluginRepositoryServerWithPlugin) Cleanup ¶
func (pluginRepoServer *PluginRepositoryServerWithPlugin) Cleanup()
Close is used to destroy the repo server and cleanup any files
func (*PluginRepositoryServerWithPlugin) Init ¶
func (pluginRepoServer *PluginRepositoryServerWithPlugin) Init(pluginName string, version string, platform string, shouldCalculateChecksum bool)
Init initializes a server to provide a single configurable_plugin with user provided name, version, and platform.
func (*PluginRepositoryServerWithPlugin) PluginSize ¶
func (pluginRepoServer *PluginRepositoryServerWithPlugin) PluginSize() int64
PluginSize is used to get the size in bytes of the single plugin provided by the pluginRepoServer
func (*PluginRepositoryServerWithPlugin) URL ¶
func (pluginRepoServer *PluginRepositoryServerWithPlugin) URL() string
URL is used to get the pluginRepo's server url
type Route ¶
Route represents a route.
func NewTCPRoute ¶
NewTCPRoute constructs a TCP route with given space, domain, and port.
func (Route) Create ¶
func (r Route) Create()
Create creates a route using the 'cf create-route' command.
func (Route) Delete ¶
func (r Route) Delete()
Delete deletes a route using the 'cf delete-route' command.
type SecurityGroup ¶
type SecurityGroup struct { Name string `json:"-"` Protocol string `json:"protocol"` Destination string `json:"destination"` Ports string `json:"ports"` Description string `json:"description"` }
SecurityGroup represents a security group API resource
func NewSecurityGroup ¶
func NewSecurityGroup(name string, protocol string, destination string, ports string, description string) SecurityGroup
NewSecurityGroup returns a new security group with the given attributes
func (SecurityGroup) Create ¶
func (s SecurityGroup) Create()
Create Creates a new security group on the API using the 'cf create-security-group'
type ServiceInstanceGUID ¶
type ServiceInstanceGUID struct { Resources []struct { Metadata struct { GUID string `json:"guid"` } `json:"metadata"` } `json:"resources"` }
ServiceInstanceGUID represents a service instance relationship
type UAAVersion ¶
type UAAVersion struct { App struct { Version string `json:"version"` } `json:"app"` }
UAAVersion a struct representation of the UAA version
func (UAAVersion) Version ¶
func (v UAAVersion) Version() string
Version returns the version of the targeted UAA
Source Files ¶
- app.go
- app_instance_table.go
- buildpack.go
- buildpack_v6.go
- client.go
- client_credentials.go
- command.go
- config.go
- constants.go
- curl.go
- date.go
- docker.go
- domains.go
- environment.go
- fake_data.go
- fake_server.go
- feature_flags.go
- file.go
- ginkgo_routing_extension.go
- isolation_segment.go
- login.go
- matchers.go
- name_generator.go
- org_and_space.go
- os.go
- package.go
- plugin.go
- plugin_repo.go
- plugin_repo_platform_unix.go
- quota.go
- random_port.go
- reporters.go
- route.go
- route_mapping.go
- security_group.go
- service_binding.go
- service_instance.go
- sha.go
- skip_experimental.go
- stack.go
- token.go
- user.go
- version.go
- version_v6.go