Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions src/binary/integration/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T
})

it.After(func() {
Expect(platform.Delete.Execute(name)).To(Succeed())
if !t.Skipped() && name != "" {
platform.Delete.Execute(name)
}
})

it("builds and runs the app when buildpack is specified", func() {
Expand All @@ -52,17 +54,31 @@ func testDefault(platform switchblade.Platform, fixtures string) func(*testing.T

context("there is no start command given", func() {
it("it fails to run", func() {
deployment, _, err := platform.Deploy.
deployment, logs, err := platform.Deploy.
WithBuildpacks("binary_buildpack").
Execute(name, filepath.Join(fixtures, "no_start_command"))
Expect(err).NotTo(HaveOccurred())

cmd := exec.Command("docker", "container", "logs", deployment.Name)
if settings.Platform == "docker" {
Expect(err).NotTo(HaveOccurred())

output, err := cmd.CombinedOutput()
Expect(err).NotTo(HaveOccurred())
cmd := exec.Command("docker", "container", "logs", deployment.Name)
output, err := cmd.CombinedOutput()
Expect(err).NotTo(HaveOccurred())

Expect(output).To(ContainSubstring("Error: no start command specified during staging or launch"), string(output))
Expect(output).To(ContainSubstring("Error: no start command specified during staging or launch"), string(output))
} else {
// On CF platform, deployment should fail during staging or the app should fail to start
// Check staging logs or deployment error
if err != nil {
// Deployment failed during staging - check error message
Expect(logs).To(ContainSubstring("no start command"), logs)
} else {
// App staged but should fail to start - check app logs
cmd := exec.Command("cf", "logs", "--recent", name)
output, _ := cmd.CombinedOutput()
Expect(string(output)).To(ContainSubstring("no start command"), string(output))
}
}
})
})
}
Expand Down
Loading