Ejemplo n.º 1
0
// buildsCreateTest uses the `deis builds:create` (or `deis pull`) command
// to promote a build from an existing docker image.
func buildsCreateTest(t *testing.T, params *utils.DeisTestConfig) {
	params.AppName = "deispullsample"
	params.ImageID = "deis/example-go:latest"
	params.ExampleApp = "example-deis-pull"
	if err := os.Mkdir(params.ExampleApp, 0755); err != nil {
		t.Fatal(err)
	}
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, appsCreateCmdNoRemote, params, false, "")
	utils.Execute(t, buildsCreateCmd, params, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
}
Ejemplo n.º 2
0
func buildsListTest(t *testing.T, params *utils.DeisTestConfig) {
	cmd := buildsListCmd
	var cmdBuf bytes.Buffer
	tmpl := template.Must(template.New("cmd").Parse(cmd))
	if err := tmpl.Execute(&cmdBuf, params); err != nil {
		t.Fatal(err)
	}
	cmdString := cmdBuf.String()
	cmdl := exec.Command("sh", "-c", utils.Deis+cmdString)
	stdout, _, err := utils.RunCommandWithStdoutStderr(cmdl)
	if err != nil {
		t.Fatal(err)
	}
	ImageID := strings.Split(stdout.String(), "\n")[2]
	params.ImageID = strings.Fields(ImageID)[0]
}