func NewRunawayAppTestSuiteSetup(config testSuiteConfig) *ReproducibleTestSuiteSetup {
	testSpace := internal.NewRegularTestSpace(config, RUNAWAY_QUOTA_MEM_LIMIT)
	testUser := internal.NewTestUser(config, commandstarter.NewCommandStarter())
	adminUser := internal.NewAdminUser(config, commandstarter.NewCommandStarter())

	shortTimeout := config.GetScaledTimeout(1 * time.Minute)
	regularUserContext := NewUserContext(config.GetApiEndpoint(), testUser, testSpace, config.GetSkipSSLValidation(), shortTimeout)
	adminUserContext := NewUserContext(config.GetApiEndpoint(), adminUser, nil, config.GetSkipSSLValidation(), shortTimeout)

	return NewBaseTestSuiteSetup(config, testSpace, testUser, regularUserContext, adminUserContext)
}
func NewPersistentAppTestSuiteSetup(config testSuiteConfig) *ReproducibleTestSuiteSetup {
	testSpace := internal.NewPersistentAppTestSpace(config)
	testUser := internal.NewTestUser(config, commandstarter.NewCommandStarter())
	adminUser := internal.NewAdminUser(config, commandstarter.NewCommandStarter())

	shortTimeout := config.GetScaledTimeout(1 * time.Minute)
	regularUserContext := NewUserContext(config.GetApiEndpoint(), testUser, testSpace, config.GetSkipSSLValidation(), shortTimeout)
	adminUserContext := NewUserContext(config.GetApiEndpoint(), adminUser, nil, config.GetSkipSSLValidation(), shortTimeout)

	testSuiteSetup := NewBaseTestSuiteSetup(config, testSpace, testUser, regularUserContext, adminUserContext)
	testSuiteSetup.isPersistent = true

	return testSuiteSetup
}
Ejemplo n.º 3
0
func Run(executable string, args ...string) *gexec.Session {
	cmdStarter := commandstarter.NewCommandStarter()
	reporter := commandreporter.NewCommandReporter()

	session, err := cmdStarter.Start(reporter, executable, args...)
	if err != nil {
		panic(err)
	}
	return session
}
Ejemplo n.º 4
0
func NewRegularTestSpace(cfg spaceConfig, quotaLimit string) *TestSpace {
	return NewBaseTestSpace(
		generator.PrefixedRandomName(cfg.GetNamePrefix(), "SPACE"),
		generator.PrefixedRandomName(cfg.GetNamePrefix(), "ORG"),
		generator.PrefixedRandomName(cfg.GetNamePrefix(), "QUOTA"),
		quotaLimit,
		false,
		cfg.GetScaledTimeout(1*time.Minute),
		commandstarter.NewCommandStarter(),
	)
}
Ejemplo n.º 5
0
func NewPersistentAppTestSpace(cfg spaceConfig) *TestSpace {
	baseTestSpace := NewBaseTestSpace(
		cfg.GetPersistentAppSpace(),
		cfg.GetPersistentAppOrg(),
		cfg.GetPersistentAppQuotaName(),
		"10G",
		true,
		cfg.GetScaledTimeout(1*time.Minute),
		commandstarter.NewCommandStarter(),
	)
	return baseTestSpace
}
Ejemplo n.º 6
0
func NewUserContext(apiUrl string, testUser userValues, testSpace spaceValues, skipSSLValidation bool, timeout time.Duration) UserContext {
	var org, space string
	if testSpace != nil {
		org = testSpace.OrganizationName()
		space = testSpace.SpaceName()
	}

	return UserContext{
		ApiUrl:            apiUrl,
		Username:          testUser.Username(),
		Password:          testUser.Password(),
		TestSpace:         testSpace,
		TestUser:          testUser,
		Org:               org,
		Space:             space,
		SkipSSLValidation: skipSSLValidation,
		CommandStarter:    commandstarter.NewCommandStarter(),
		Timeout:           timeout,
	}
}
Ejemplo n.º 7
0
package cf

import (
	"github.com/cloudfoundry-incubator/cf-test-helpers/commandstarter"
	"github.com/cloudfoundry-incubator/cf-test-helpers/internal"
	"github.com/onsi/gomega/gexec"
)

var Cf = func(args ...string) *gexec.Session {
	cmdStarter := commandstarter.NewCommandStarter()
	return internal.Cf(cmdStarter, args...)
}
Ejemplo n.º 8
0
package workflowhelpers

import (
	"time"

	"github.com/cloudfoundry-incubator/cf-test-helpers/commandstarter"
	"github.com/cloudfoundry-incubator/cf-test-helpers/workflowhelpers/internal"
)

type GenericResource struct {
	Metadata struct {
		Guid string `json:"guid"`
	} `json:"metadata"`
}

type QueryResponse struct {
	Resources []GenericResource `struct:"resources"`
}

var ApiRequest = func(method, endpoint string, response interface{}, timeout time.Duration, data ...string) {
	internal.ApiRequest(commandstarter.NewCommandStarter(), method, endpoint, response, timeout, data...)
}