Exemplo n.º 1
0
func (ts *TestSpace) Destroy() {
	deleteOrg := internal.Cf(ts.CommandStarter, "delete-org", "-f", ts.organizationName)
	EventuallyWithOffset(1, deleteOrg, ts.Timeout).Should(Exit(0))

	deleteQuota := internal.Cf(ts.CommandStarter, "delete-quota", "-f", ts.QuotaDefinitionName)
	EventuallyWithOffset(1, deleteQuota, ts.Timeout).Should(Exit(0))
}
Exemplo n.º 2
0
func (uc UserContext) AddUserToSpace() {
	username := uc.TestUser.Username()
	orgName := uc.TestSpace.OrganizationName()
	spaceName := uc.TestSpace.SpaceName()

	spaceManager := internal.Cf(uc.CommandStarter, "set-space-role", username, orgName, spaceName, "SpaceManager")
	EventuallyWithOffset(1, spaceManager, uc.Timeout).Should(Exit(0))

	spaceDeveloper := internal.Cf(uc.CommandStarter, "set-space-role", username, orgName, spaceName, "SpaceDeveloper")
	EventuallyWithOffset(1, spaceDeveloper, uc.Timeout).Should(Exit(0))

	spaceAuditor := internal.Cf(uc.CommandStarter, "set-space-role", username, orgName, spaceName, "SpaceAuditor")
	EventuallyWithOffset(1, spaceAuditor, uc.Timeout).Should(Exit(0))
}
Exemplo n.º 3
0
func (uc UserContext) TargetSpace() {
	if uc.TestSpace != nil && uc.TestSpace.OrganizationName() != "" {
		var session *Session
		session = internal.Cf(uc.CommandStarter, "target", "-o", uc.TestSpace.OrganizationName(), "-s", uc.TestSpace.SpaceName())
		EventuallyWithOffset(1, session, uc.Timeout).Should(Exit(0))
	}
}
Exemplo n.º 4
0
func (user *TestUser) Create() {
	session := internal.Cf(user.cmdStarter, "create-user", user.username, user.password)
	EventuallyWithOffset(1, session, user.timeout).Should(Exit())
	if session.ExitCode() != 0 {
		ExpectWithOffset(1, session.Out).Should(Say("scim_resource_already_exists"))
	}
}
Exemplo n.º 5
0
func (uc UserContext) Login() {
	args := []string{"api", uc.ApiUrl}
	if uc.SkipSSLValidation {
		args = append(args, "--skip-ssl-validation")
	}
	session := internal.Cf(uc.CommandStarter, args...)
	EventuallyWithOffset(1, session, uc.Timeout).Should(Exit(0))

	session = workflowhelpersinternal.CfAuth(uc.CommandStarter, uc.TestUser.Username(), uc.TestUser.Password())
	EventuallyWithOffset(1, session, uc.Timeout).Should(Exit(0))
}
Exemplo n.º 6
0
func (ts *TestSpace) Create() {
	args := []string{
		"create-quota",
		ts.QuotaDefinitionName,
		"-m", ts.QuotaDefinitionTotalMemoryLimit,
		"-i", ts.QuotaDefinitionInstanceMemoryLimit,
		"-r", ts.QuotaDefinitionRoutesLimit,
		"-a", ts.QuotaDefinitionAppInstanceLimit,
		"-s", ts.QuotaDefinitionServiceInstanceLimit,
		ts.QuotaDefinitionAllowPaidServicesFlag,
	}

	createQuota := internal.Cf(ts.CommandStarter, args...)
	EventuallyWithOffset(1, createQuota, ts.Timeout).Should(Exit(0))

	createOrg := internal.Cf(ts.CommandStarter, "create-org", ts.organizationName)
	EventuallyWithOffset(1, createOrg, ts.Timeout).Should(Exit(0))

	setQuota := internal.Cf(ts.CommandStarter, "set-quota", ts.organizationName, ts.QuotaDefinitionName)
	EventuallyWithOffset(1, setQuota, ts.Timeout).Should(Exit(0))

	createSpace := internal.Cf(ts.CommandStarter, "create-space", "-o", ts.organizationName, ts.spaceName)
	EventuallyWithOffset(1, createSpace, ts.Timeout).Should(Exit(0))
}
Exemplo n.º 7
0
func (uc UserContext) Logout() {
	session := internal.Cf(uc.CommandStarter, "logout")
	EventuallyWithOffset(1, session, uc.Timeout).Should(Exit(0))
}
Exemplo n.º 8
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...)
}
Exemplo n.º 9
0
func (user *TestUser) Destroy() {
	session := internal.Cf(user.cmdStarter, "delete-user", "-f", user.username)
	EventuallyWithOffset(1, session, user.timeout).Should(Exit(0))
}