本文整理匯總了Golang中github.com/cloudfoundry-incubator/cf-test-helpers/helpers.NewEnvironment函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewEnvironment函數的具體用法?Golang NewEnvironment怎麽用?Golang NewEnvironment使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewEnvironment函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestApplications
func TestApplications(t *testing.T) {
RegisterFailHandler(Fail)
SetDefaultEventuallyTimeout(time.Minute)
SetDefaultEventuallyPollingInterval(time.Second)
config := helpers.LoadConfig()
context = helpers.NewContext(config)
environment := helpers.NewEnvironment(context)
BeforeSuite(func() {
environment.Setup()
})
AfterSuite(func() {
environment.Teardown()
})
componentName := "SecurityGroups"
rs := []Reporter{}
if config.ArtifactsDirectory != "" {
helpers.EnableCFTrace(config, componentName)
rs = append(rs, helpers.NewJUnitReporter(config, componentName))
}
RunSpecsWithDefaultAndCustomReporters(t, componentName, rs)
}
示例2: TestDetect
func TestDetect(t *testing.T) {
RegisterFailHandler(Fail)
config = helpers.LoadConfig()
if config.DefaultTimeout > 0 {
DEFAULT_TIMEOUT = config.DefaultTimeout * time.Second
}
if config.DetectTimeout > 0 {
DETECT_TIMEOUT = config.DetectTimeout * time.Second
}
context = helpers.NewContext(config)
environment := helpers.NewEnvironment(context)
BeforeSuite(func() {
environment.Setup()
})
AfterSuite(func() {
environment.Teardown()
})
componentName := "Buildpack Detection"
rs := []Reporter{}
if config.ArtifactsDirectory != "" {
helpers.EnableCFTrace(config, componentName)
rs = append(rs, helpers.NewJUnitReporter(config, componentName))
}
RunSpecsWithDefaultAndCustomReporters(t, componentName, rs)
}
示例3: TestApplications
func TestApplications(t *testing.T) {
RegisterFailHandler(Fail)
SetDefaultEventuallyTimeout(time.Minute)
SetDefaultEventuallyPollingInterval(time.Second)
config := helpers.LoadConfig()
context = helpers.NewContext(config)
environment := helpers.NewEnvironment(context)
var _ = SynchronizedBeforeSuite(func() []byte {
path, err := exec.LookPath("scp")
Expect(err).NotTo(HaveOccurred())
return []byte(path)
}, func(encodedSCPPath []byte) {
scpPath = string(encodedSCPPath)
environment.Setup()
})
AfterSuite(func() {
environment.Teardown()
})
componentName := "SSH"
rs := []Reporter{}
if config.ArtifactsDirectory != "" {
helpers.EnableCFTrace(config, componentName)
rs = append(rs, helpers.NewJUnitReporter(config, componentName))
}
RunSpecsWithDefaultAndCustomReporters(t, componentName, rs)
}
示例4: TestRouting
func TestRouting(t *testing.T) {
RegisterFailHandler(Fail)
config = helpers.LoadConfig()
componentName := "Routing"
rs := []Reporter{}
context := helpers.NewContext(config)
environment := helpers.NewEnvironment(context)
BeforeSuite(func() {
Expect(config.SystemDomain).ToNot(Equal(""), "Must provide a system domain for the routing suite")
Expect(config.ClientSecret).ToNot(Equal(""), "Must provide a client secret for the routing suite")
environment.Setup()
})
AfterSuite(func() {
environment.Teardown()
})
if config.ArtifactsDirectory != "" {
helpers.EnableCFTrace(config, componentName)
rs = append(rs, helpers.NewJUnitReporter(config, componentName))
}
RunSpecsWithDefaultAndCustomReporters(t, componentName, rs)
}
示例5: TestElasticsearchService
func TestElasticsearchService(t *testing.T) {
RegisterFailHandler(Fail)
config = helpers.LoadConfig()
if config.DefaultTimeout > 0 {
DEFAULT_TIMEOUT = config.DefaultTimeout * time.Second
}
if config.CfPushTimeout > 0 {
CF_PUSH_TIMEOUT = config.CfPushTimeout * time.Second
}
context = helpers.NewContext(config)
environment := helpers.NewEnvironment(context)
BeforeSuite(func() {
environment.Setup()
})
AfterSuite(func() {
//environment.Teardown()
})
RunSpecs(t, "Elasticsearch Service")
}
示例6: TestSuite
func TestSuite(t *testing.T) {
RegisterFailHandler(Fail)
config = helpers.LoadConfig()
if config.DefaultTimeout > 0 {
DEFAULT_TIMEOUT = config.DefaultTimeout * time.Second
}
if config.CfPushTimeout > 0 {
CF_PUSH_TIMEOUT = config.CfPushTimeout * time.Second
}
if config.LongCurlTimeout > 0 {
LONG_CURL_TIMEOUT = config.LongCurlTimeout * time.Second
}
context = helpers.NewContext(config)
environment := helpers.NewEnvironment(context)
BeforeSuite(func() {
environment.Setup()
})
AfterSuite(func() {
environment.Teardown()
})
RunSpecs(t, "Performance tests")
}
示例7: TestLats
func TestLats(t *testing.T) {
RegisterFailHandler(Fail)
var environment *helpers.Environment
BeforeSuite(func() {
config = helpers.LoadConfig()
context := helpers.NewContext(config)
environment = helpers.NewEnvironment(context)
environment.Setup()
})
AfterSuite(func() {
environment.Teardown()
})
RunSpecs(t, "Lats Suite")
}
示例8: TestApplications
func TestApplications(t *testing.T) {
RegisterFailHandler(Fail)
config = helpers.LoadConfig()
if config.DefaultTimeout > 0 {
DEFAULT_TIMEOUT = config.DefaultTimeout * time.Second
}
if config.CfPushTimeout > 0 {
CF_PUSH_TIMEOUT = config.CfPushTimeout * time.Second
}
if config.LongCurlTimeout > 0 {
LONG_CURL_TIMEOUT = config.LongCurlTimeout * time.Second
}
context = helpers.NewContext(config)
environment := helpers.NewEnvironment(context)
BeforeSuite(func() {
environment.Setup()
})
AfterSuite(func() {
environment.Teardown()
})
componentName := "Docker"
rs := []Reporter{}
if config.ArtifactsDirectory != "" {
helpers.EnableCFTrace(config, componentName)
rs = append(rs, helpers.NewJUnitReporter(config, componentName))
}
RunSpecsWithDefaultAndCustomReporters(t, componentName, rs)
}
示例9:
. "github.com/onsi/gomega/gexec"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
)
var _ = Describe("An application that's already been pushed", func() {
var appName string
config := helpers.LoadConfig()
var environment *helpers.Environment
BeforeEach(func() {
persistentContext := helpers.NewPersistentAppContext(config)
environment = helpers.NewEnvironment(persistentContext)
environment.Setup()
})
AfterEach(func() {
app_helpers.AppReport(appName, DEFAULT_TIMEOUT)
environment.Teardown()
})
BeforeEach(func() {
appName = config.PersistentAppHost
appQuery := cf.Cf("app", appName).Wait(DEFAULT_TIMEOUT)
// might exit with 1 or 0, depending on app status
output := string(appQuery.Out.Contents())
示例10: TestPersiAcceptance
func TestPersiAcceptance(t *testing.T) {
RegisterFailHandler(Fail)
cfConfig = helpers.LoadConfig()
defaults(&cfConfig)
err := getPatsSpecificConfig()
if err != nil {
panic(err)
}
brokerName = pConfig.ServiceName + "-broker"
componentName := "PATS Suite"
rs := []Reporter{}
SynchronizedBeforeSuite(func() []byte {
patsSuiteContext = helpers.NewContext(cfConfig)
cf.AsUser(patsSuiteContext.AdminUserContext(), DEFAULT_TIMEOUT, func() {
// make sure we don't have a leftover service broker from another test
deleteBroker(pConfig.BrokerUrl)
if pConfig.PushedBrokerName != "" {
// push the service broker as a cf application
Expect(pConfig.SqlServiceName).ToNot(BeEmpty())
appPath := os.Getenv("BROKER_APPLICATION_PATH")
Expect(appPath).To(BeADirectory(), "BROKER_APPLICATION_PATH environment variable should point to a CF application")
assetsPath := os.Getenv("ASSETS_PATH")
Expect(assetsPath).To(BeADirectory(), "ASSETS_PATH environment variable should be a directory")
Eventually(cf.Cf("update-security-group", "public_networks", filepath.Join(assetsPath, "security.json")), DEFAULT_TIMEOUT).Should(Exit(0))
Eventually(cf.Cf("push", pConfig.PushedBrokerName, "-p", appPath, "-f", appPath+"/manifest.yml", "--no-start"), DEFAULT_TIMEOUT).Should(Exit(0))
Eventually(cf.Cf("bind-service", pConfig.PushedBrokerName, pConfig.SqlServiceName), DEFAULT_TIMEOUT).Should(Exit(0))
Eventually(cf.Cf("start", pConfig.PushedBrokerName), DEFAULT_TIMEOUT).Should(Exit(0))
}
createServiceBroker := cf.Cf("create-service-broker", brokerName, pConfig.BrokerUser, pConfig.BrokerPassword, pConfig.BrokerUrl).Wait(DEFAULT_TIMEOUT)
Expect(createServiceBroker).To(Exit(0))
Expect(createServiceBroker).To(Say(brokerName))
})
return nil
}, func(_ []byte) {
patsTestContext = helpers.NewContext(cfConfig)
patsTestEnvironment = helpers.NewEnvironment(patsTestContext)
patsTestEnvironment.Setup()
})
SynchronizedAfterSuite(func() {
if patsTestEnvironment != nil {
patsTestEnvironment.Teardown()
}
}, func() {
cf.AsUser(patsSuiteContext.AdminUserContext(), DEFAULT_TIMEOUT, func() {
session := cf.Cf("delete-service-broker", "-f", brokerName).Wait(DEFAULT_TIMEOUT)
if session.ExitCode() != 0 {
cf.Cf("purge-service-offering", pConfig.ServiceName).Wait(DEFAULT_TIMEOUT)
Fail("pats service broker could not be cleaned up.")
}
})
})
if cfConfig.ArtifactsDirectory != "" {
helpers.EnableCFTrace(cfConfig, componentName)
rs = append(rs, helpers.NewJUnitReporter(cfConfig, componentName))
}
RunSpecsWithDefaultAndCustomReporters(t, componentName, rs)
}
開發者ID:cloudfoundry-incubator,項目名稱:persi-acceptance-tests,代碼行數:73,代碼來源:persi_acceptance_suite_test.go