forked from cloudfoundry/cf-acceptance-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
202 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -e -x | ||
|
||
. $(dirname $0)/goenv | ||
|
||
go install -v github.com/onsi/ginkgo/ginkgo | ||
echo "RUNNING LOCAL CODE" | ||
ginkgo -r -slowSpecThreshold=120 $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package diego | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/cloudfoundry/cf-acceptance-tests/helpers" | ||
) | ||
|
||
const ( | ||
DEFAULT_TIMEOUT = 30 * time.Second | ||
CF_PUSH_TIMEOUT = 2 * time.Minute | ||
LONG_CURL_TIMEOUT = 2 * time.Minute | ||
) | ||
|
||
var context helpers.SuiteContext | ||
|
||
func TestApplications(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
|
||
config := helpers.LoadConfig() | ||
context = helpers.NewContext(config) | ||
environment := helpers.NewEnvironment(context) | ||
|
||
BeforeSuite(func() { | ||
environment.Setup() | ||
}) | ||
|
||
AfterSuite(func() { | ||
environment.Teardown() | ||
}) | ||
|
||
componentName := "Diego" | ||
|
||
rs := []Reporter{} | ||
|
||
if config.ArtifactsDirectory != "" { | ||
helpers.EnableCFTrace(config, componentName) | ||
rs = append(rs, helpers.NewJUnitReporter(config, componentName)) | ||
} | ||
|
||
RunSpecsWithDefaultAndCustomReporters(t, componentName, rs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package diego | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
. "github.com/onsi/gomega/gbytes" | ||
. "github.com/onsi/gomega/gexec" | ||
|
||
"github.com/cloudfoundry-incubator/cf-test-helpers/cf" | ||
"github.com/cloudfoundry-incubator/cf-test-helpers/generator" | ||
"github.com/cloudfoundry/cf-acceptance-tests/helpers" | ||
) | ||
|
||
var _ = Describe("Application staging with Diego", func() { | ||
var appName string | ||
|
||
BeforeEach(func() { | ||
appName = generator.RandomName() | ||
|
||
//Diego needs a custom buildpack until the ruby buildpack lands | ||
Eventually(cf.Cf("push", appName, "-p", helpers.NewAssets().Dora, "--no-start", "-b=https://github.com/cloudfoundry/cf-buildpack-ruby/archive/master.zip"), CF_PUSH_TIMEOUT).Should(Exit(0)) | ||
Eventually(cf.Cf("set-env", appName, "CF_DIEGO_BETA", "true"), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
Eventually(cf.Cf("start", appName), CF_PUSH_TIMEOUT).Should(Exit(0)) | ||
}) | ||
|
||
AfterEach(func() { | ||
Eventually(cf.Cf("delete", appName, "-f"), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
}) | ||
|
||
Describe("pushing", func() { | ||
It("makes the app reachable via its bound route", func() { | ||
Expect(helpers.CurlAppRoot(appName)).To(ContainSubstring("Hi, I'm Dora!")) | ||
}) | ||
}) | ||
|
||
Describe("stopping", func() { | ||
BeforeEach(func() { | ||
Eventually(cf.Cf("stop", appName), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
}) | ||
|
||
It("makes the app unreachable", func() { | ||
Expect(helpers.CurlAppRoot(appName)).To(ContainSubstring("404")) | ||
}) | ||
|
||
Describe("and then starting", func() { | ||
BeforeEach(func() { | ||
Eventually(cf.Cf("start", appName), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
}) | ||
|
||
It("makes the app reachable again", func() { | ||
Expect(helpers.CurlAppRoot(appName)).To(ContainSubstring("Hi, I'm Dora!")) | ||
}) | ||
}) | ||
}) | ||
|
||
Describe("updating", func() { | ||
It("is reflected through another push", func() { | ||
Expect(helpers.CurlAppRoot(appName)).To(ContainSubstring("Hi, I'm Dora!")) | ||
|
||
Eventually(cf.Cf("push", appName, "-p", helpers.NewAssets().HelloWorld), CF_PUSH_TIMEOUT).Should(Exit(0)) | ||
|
||
Expect(helpers.CurlAppRoot(appName)).To(ContainSubstring("Hello, world!")) | ||
}) | ||
}) | ||
|
||
Describe("deleting", func() { | ||
BeforeEach(func() { | ||
Eventually(cf.Cf("delete", appName, "-f"), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
}) | ||
|
||
It("removes the application and makes the app unreachable", func() { | ||
Eventually(cf.Cf("app", appName), DEFAULT_TIMEOUT).Should(Say("not found")) | ||
Expect(helpers.CurlAppRoot(appName)).To(ContainSubstring("404")) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package diego | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
. "github.com/onsi/gomega/gexec" | ||
|
||
"github.com/cloudfoundry-incubator/cf-test-helpers/cf" | ||
"github.com/cloudfoundry-incubator/cf-test-helpers/generator" | ||
"github.com/cloudfoundry/cf-acceptance-tests/helpers" | ||
) | ||
|
||
var _ = Describe("When staging fails", func() { | ||
var appName string | ||
|
||
BeforeEach(func() { | ||
appName = generator.RandomName() | ||
|
||
//Diego needs a custom buildpack until the ruby buildpack lands | ||
Eventually(cf.Cf("push", appName, "-p", helpers.NewAssets().Dora, "--no-start", "-b=http://example.com/so-not-a-thing/adlfijaskldjlkjaslbnalwieulfjkjsvas.zip"), CF_PUSH_TIMEOUT).Should(Exit(0)) | ||
Eventually(cf.Cf("set-env", appName, "CF_DIEGO_BETA", "true"), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
}) | ||
|
||
AfterEach(func() { | ||
Eventually(cf.Cf("delete", appName, "-f"), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
}) | ||
|
||
It("informs the user", func() { | ||
start := cf.Cf("start", appName) | ||
Eventually(start, CF_PUSH_TIMEOUT).Should(Exit(1)) | ||
Ω(start.Out).Should(Say("Failed to Download Buildpack")) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package diego | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
. "github.com/onsi/gomega/gbytes" | ||
. "github.com/onsi/gomega/gexec" | ||
|
||
"github.com/cloudfoundry-incubator/cf-test-helpers/cf" | ||
"github.com/cloudfoundry-incubator/cf-test-helpers/generator" | ||
"github.com/cloudfoundry/cf-acceptance-tests/helpers" | ||
) | ||
|
||
var _ = Describe("An application being staged with Diego", func() { | ||
var appName string | ||
|
||
BeforeEach(func() { | ||
appName = generator.RandomName() | ||
}) | ||
|
||
AfterEach(func() { | ||
Eventually(cf.Cf("delete", appName, "-f"), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
}) | ||
|
||
It("has its staging log streamed during a push", func() { | ||
//Diego needs a custom buildpack until the ruby buildpack lands | ||
Eventually(cf.Cf("push", appName, "-p", helpers.NewAssets().Dora, "--no-start", "-b=https://github.com/cloudfoundry/cf-buildpack-ruby/archive/master.zip"), CF_PUSH_TIMEOUT).Should(Exit(0)) | ||
Eventually(cf.Cf("set-env", appName, "CF_DIEGO_BETA", "true"), DEFAULT_TIMEOUT).Should(Exit(0)) | ||
|
||
start := cf.Cf("start", appName) | ||
|
||
Eventually(start, CF_PUSH_TIMEOUT).Should(Say("Downloading App Package")) | ||
Eventually(start, CF_PUSH_TIMEOUT).Should(Say("Downloaded App Package")) | ||
Eventually(start, CF_PUSH_TIMEOUT).Should(Say(`Staging\.\.\.`)) | ||
Eventually(start, CF_PUSH_TIMEOUT).Should(Exit(0)) | ||
}) | ||
}) |