-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathcommands.go
More file actions
36 lines (28 loc) · 1.1 KB
/
commands.go
File metadata and controls
36 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package builds
import (
"time"
"github.com/deis/workflow-e2e/tests/cmd"
"github.com/deis/workflow-e2e/tests/model"
"github.com/deis/workflow-e2e/tests/settings"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
)
// The functions in this file implement SUCCESS CASES for commonly used `deis builds` subcommands.
// This allows each of these to be re-used easily in multiple contexts.
const ExampleImage = "deis/example-dockerfile-http"
// Create executes `deis builds:create` as the specified user.
func Create(user model.User, app model.App) {
createOrPull(user, app, "builds:create")
}
// Pull executes the `deis pull` shortcut as the specified user.
func Pull(user model.User, app model.App) {
createOrPull(user, app, "pull")
}
func createOrPull(user model.User, app model.App, command string) {
sess, err := cmd.Start("deis %s --app=%s %s", &user, command, app.Name, ExampleImage)
Expect(err).NotTo(HaveOccurred())
Eventually(sess).Should(Say("Creating build..."))
Eventually(sess, settings.MaxEventuallyTimeout).Should(Exit(0))
time.Sleep(10 * time.Second)
}