Skip to content

Commit

Permalink
Support legacy environment in push tests
Browse files Browse the repository at this point in the history
Our legacy environment has cflinuxfs2 and not cflinuxfs3.
Make push tests use cflinuxfs3 but fall back to cflinuxfs2.

[#165733811](https://www.pivotaltracker.com/story/show/165733811)

Co-authored-by: Will Murphy <wmurphy@pivotal.io>
  • Loading branch information
bwasmith and willmurphyscode committed Apr 30, 2019
1 parent 5a09b7c commit df55043
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
15 changes: 14 additions & 1 deletion integration/helpers/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"encoding/json"

"fmt"
"strings"

. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
"strings"
)

type ccStacks struct {
Expand Down Expand Up @@ -35,6 +36,18 @@ func FetchStacks() []string {
return stacks
}

func PreferredStack() string {
stacks := FetchStacks()

for _, name := range stacks {
if name == "cflinuxfs3" {
return name
}
}

return "cflinuxfs2"
}

func CreateStack(names ...string) string {
name := NewStackName()
if len(names) > 0 {
Expand Down
16 changes: 9 additions & 7 deletions integration/v6/push/app_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import (

var _ = Describe("push with various flags and no manifest", func() {
var (
appName string
appName string
stackName string
)

BeforeEach(func() {
appName = helpers.NewAppName()
stackName = helpers.PreferredStack()
})

It("creates the app with the specified settings, with the health check type", func() {
Expand All @@ -31,7 +33,7 @@ var _ = Describe("push with various flags and no manifest", func() {
"-k", "300M",
"-i", "2",
"-m", "70M",
"-s", "cflinuxfs3",
"-s", stackName,
"-t", "180",
)
Eventually(session).Should(Say(`Getting app info\.\.\.`))
Expand All @@ -44,7 +46,7 @@ var _ = Describe("push with various flags and no manifest", func() {
Eventually(session).Should(Say(`\s+health check type:\s+port`))
Eventually(session).Should(Say(`\s+instances:\s+2`))
Eventually(session).Should(Say(`\s+memory:\s+70M`))
Eventually(session).Should(Say(`\s+stack:\s+cflinuxfs3`))
Eventually(session).Should(Say(`\s+stack:\s+%s`, stackName))
Eventually(session).Should(Say(`\s+routes:`))
Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, appName, helpers.DefaultSharedDomain()))
Eventually(session).Should(Say(`Mapping routes\.\.\.`))
Expand All @@ -62,7 +64,7 @@ var _ = Describe("push with various flags and no manifest", func() {
session := helpers.CF("app", appName)
Eventually(session).Should(Say(`name:\s+%s`, appName))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`))
Eventually(session).Should(Say(`stack:\s+cflinuxfs3`))
Eventually(session).Should(Say(`stack:\s+%s`, stackName))
Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
Eventually(session).Should(Say(`type:\s+web`))
Eventually(session).Should(Say(`instances:\s+2/2`))
Expand All @@ -82,7 +84,7 @@ var _ = Describe("push with various flags and no manifest", func() {
"-k", "300M",
"-i", "2",
"-m", "70M",
"-s", "cflinuxfs3",
"-s", stackName,
"-t", "180",
)

Expand All @@ -97,7 +99,7 @@ var _ = Describe("push with various flags and no manifest", func() {
Eventually(session).Should(Say(`\s+health check type:\s+http`))
Eventually(session).Should(Say(`\s+instances:\s+2`))
Eventually(session).Should(Say(`\s+memory:\s+70M`))
Eventually(session).Should(Say(`\s+stack:\s+cflinuxfs3`))
Eventually(session).Should(Say(`\s+stack:\s+%s`, stackName))
Eventually(session).Should(Say(`\s+routes:`))
Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, appName, helpers.DefaultSharedDomain()))
Eventually(session).Should(Say(`Mapping routes\.\.\.`))
Expand All @@ -117,7 +119,7 @@ var _ = Describe("push with various flags and no manifest", func() {
session := helpers.CF("app", appName)
Eventually(session).Should(Say(`name:\s+%s`, appName))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`))
Eventually(session).Should(Say(`stack:\s+cflinuxfs3`))
Eventually(session).Should(Say(`stack:\s+%s`, stackName))
Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
Eventually(session).Should(Say(`type:\s+web`))
Eventually(session).Should(Say(`instances:\s+2/2`))
Expand Down
12 changes: 7 additions & 5 deletions integration/v6/push/simple_manifest_only_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import (

var _ = Describe("push with a simple manifest and no flags", func() {
var (
appName string
username string
appName string
username string
stackName string
)

BeforeEach(func() {
appName = helpers.NewAppName()
username, _ = helpers.GetCredentials()
stackName = helpers.PreferredStack()
})

When("the app is new", func() {
Expand All @@ -46,7 +48,7 @@ var _ = Describe("push with a simple manifest and no flags", func() {
},
"instances": 2,
"memory": "70M",
"stack": "cflinuxfs3",
"stack": stackName,
"health-check-type": "http",
"health-check-http-endpoint": "/",
"timeout": 180,
Expand All @@ -68,7 +70,7 @@ var _ = Describe("push with a simple manifest and no flags", func() {
Eventually(session).Should(Say(`\s+health check type:\s+http`))
Eventually(session).Should(Say(`\s+instances:\s+2`))
Eventually(session).Should(Say(`\s+memory:\s+70M`))
Eventually(session).Should(Say(`\s+stack:\s+cflinuxfs3`))
Eventually(session).Should(Say(`\s+stack:\s+%s`, stackName))
Eventually(session).Should(Say(`\s+env:`))
Eventually(session).Should(Say(`\+\s+key1`))
Eventually(session).Should(Say(`\+\s+key2`))
Expand All @@ -92,7 +94,7 @@ var _ = Describe("push with a simple manifest and no flags", func() {
session := helpers.CF("app", appName)
Eventually(session).Should(Say(`name:\s+%s`, appName))
Eventually(session).Should(Say(`last uploaded:\s+\w{3} \d{1,2} \w{3} \d{2}:\d{2}:\d{2} \w{3} \d{4}`))
Eventually(session).Should(Say(`stack:\s+cflinuxfs3`))
Eventually(session).Should(Say(`stack:\s+%s`, stackName))
Eventually(session).Should(Say(`buildpacks:\s+staticfile`))
Eventually(session).Should(Say(`type:\s+web`))
Eventually(session).Should(Say(`instances:\s+2/2`))
Expand Down

0 comments on commit df55043

Please sign in to comment.