Skip to content

Commit

Permalink
Merge pull request #648 from cloudfoundry/add_cflinuxfs4_stack
Browse files Browse the repository at this point in the history
Add cflinuxfs4 to list of stacks
  • Loading branch information
jochenehret authored Nov 28, 2022
2 parents 785fd92 + c2648ad commit ac7eda3
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 85 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ include_v3
* `windows_stack`: Windows stack to run tests against. Must be `windows`.

* `include_service_discovery`: Flag to include test for the service discovery. These tests use `apps.internal` domain, which is the default in `cf-networking-release`. The internal domain is currently not configurable.
* `stacks`: An array of stacks to test against. Currently only `cflinuxfs3` stack is supported. Default is `[cflinuxfs3]`.
* `stacks`: An array of stacks to test against. Currently `cflinuxfs3` and `cflinuxfs4` stacks are supported. Default is `[cflinuxfs3]`.

* `include_volume_services`: Flag to include the tests for volume services. The following requirements must be met to run this suite: tcp-routing must be deployed.
* `volume_service_name`: The name of the volume service provided by the volume service broker.
Expand Down
202 changes: 123 additions & 79 deletions detect/buildpacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,68 +32,97 @@ var _ = DetectDescribe("Buildpacks", func() {
})

Describe("ruby", func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push",
appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().HelloWorld,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello, world!"))
})
for _, stack := range Config.GetStacks() {
Context(fmt.Sprintf("when using %s stack", stack), func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push",
appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().HelloWorld,
"-s", stack,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello, world!"))
})
})
}
})

Describe("node", func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().Node).Wait(Config.DetectTimeoutDuration())).To(Exit(0))
for _, stack := range Config.GetStacks() {
Context(fmt.Sprintf("when using %s stack", stack), func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push",
appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Node,
"-s", stack,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from a node app!"))
})
Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from a node app!"))
})
})
}
})

Describe("java", func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-p", assets.NewAssets().Java,
"-m", "1024M",
"-f", filepath.Join(assets.NewAssets().Java, "manifest.yml"),
).Wait(CF_JAVA_TIMEOUT)).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello, from your friendly neighborhood Java JSP!"))
})
for _, stack := range Config.GetStacks() {
Context(fmt.Sprintf("when using %s stack", stack), func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-p", assets.NewAssets().Java,
"-m", "1024M",
"-f", filepath.Join(assets.NewAssets().Java, "manifest.yml"),
"-s", stack,
).Wait(CF_JAVA_TIMEOUT)).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello, from your friendly neighborhood Java JSP!"))
})
})
}
})

Describe("golang", func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Golang,
"-f", filepath.Join(assets.NewAssets().Golang, "manifest.yml"),
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("go, world"))
})
for _, stack := range Config.GetStacks() {
Context(fmt.Sprintf("when using %s stack", stack), func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Golang,
"-f", filepath.Join(assets.NewAssets().Golang, "manifest.yml"),
"-s", stack,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("go, world"))
})
})
}
})

Describe("python", func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Python,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("python, world"))
})
for _, stack := range Config.GetStacks() {
Context(fmt.Sprintf("when using %s stack", stack), func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Python,
"-s", stack,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("python, world"))
})
})
}
})

Describe("php", func() {
Expand All @@ -104,16 +133,21 @@ var _ = DetectDescribe("Buildpacks", func() {
phpPushTimeout = Config.DetectTimeoutDuration() + 6*time.Minute
})

It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Php,
).Wait(phpPushTimeout)).To(Exit(0))
for _, stack := range Config.GetStacks() {
Context(fmt.Sprintf("when using %s stack", stack), func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Php,
"-s", stack,
).Wait(phpPushTimeout)).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from php"))
})
Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from php"))
})
})
}
})

Describe("dotnet-core", func() {
Expand All @@ -135,29 +169,39 @@ var _ = DetectDescribe("Buildpacks", func() {

Describe("staticfile", func() {
SkipOnK8s("staticfile not yet supported, as currently structured in CATS")
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Staticfile,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from a staticfile"))
})
for _, stack := range Config.GetStacks() {
Context(fmt.Sprintf("when using %s stack", stack), func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Staticfile,
"-s", stack,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from a staticfile"))
})
})
}
})

Describe("binary", func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-b", Config.GetBinaryBuildpackName(),
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Binary,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from a binary"))
})
for _, stack := range Config.GetStacks() {
Context(fmt.Sprintf("when using %s stack", stack), func() {
It("makes the app reachable via its bound route", func() {
Expect(cf.Cf("push", appName,
"-b", Config.GetBinaryBuildpackName(),
"-m", DEFAULT_MEMORY_LIMIT,
"-p", assets.NewAssets().Binary,
"-s", stack,
).Wait(Config.DetectTimeoutDuration())).To(Exit(0))

Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from a binary"))
})
})
}
})
})
4 changes: 2 additions & 2 deletions helpers/config/config_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ func validateStacks(config *config) error {
}

for _, stack := range config.GetStacks() {
if stack != "cflinuxfs3" {
return fmt.Errorf("* Invalid configuration: unknown stack '%s'. Only 'cflinuxfs3' is supported for the 'stacks' property", stack)
if stack != "cflinuxfs3" && stack != "cflinuxfs4" {
return fmt.Errorf("* Invalid configuration: unknown stack '%s'. Only 'cflinuxfs3' and 'cflinuxfs4' is supported for the 'stacks' property", stack)
}
}

Expand Down
18 changes: 15 additions & 3 deletions helpers/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,27 @@ var _ = Describe("Config", func() {
})
})

Context("when providing stacks property", func() {
Context("when providing invalid stacks property", func() {
BeforeEach(func() {
testCfg.Stacks = &[]string{"my-custom-stack"}
})

It("returns error if a stack other than cflinuxfs3 is provided", func() {
It("returns error if a stack other than cflinuxfs3 or cflinuxfs4 is provided", func() {
_, err := cfg.NewCatsConfig(tmpFilePath)
Expect(err).To(HaveOccurred())
Expect(err).To(MatchError("* Invalid configuration: unknown stack 'my-custom-stack'. Only 'cflinuxfs3' is supported for the 'stacks' property"))
Expect(err).To(MatchError("* Invalid configuration: unknown stack 'my-custom-stack'. Only 'cflinuxfs3' and 'cflinuxfs4' is supported for the 'stacks' property"))
})
})

Context("when providing valid stacks property", func() {
BeforeEach(func() {
testCfg.Stacks = &[]string{"cflinuxfs3", "cflinuxfs4"}
})

It("is loaded into the config", func() {
config, err := cfg.NewCatsConfig(tmpFilePath)
Expect(err).ToNot(HaveOccurred())
Expect(config.GetStacks()).To(Equal([]string{"cflinuxfs3", "cflinuxfs4"}))
})
})

Expand Down

0 comments on commit ac7eda3

Please sign in to comment.