forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nosrc.go
45 lines (37 loc) · 1.61 KB
/
nosrc.go
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
37
38
39
40
41
42
43
44
45
package builds
import (
"fmt"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[builds] build with empty source", func() {
defer g.GinkgoRecover()
var (
buildFixture = exutil.FixturePath("..", "extended", "testdata", "test-nosrc-build.json")
oc = exutil.NewCLI("cli-build-nosrc", exutil.KubeConfigPath())
exampleBuild = exutil.FixturePath("..", "extended", "testdata", "test-build-app")
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
oc.Run("create").Args("-f", buildFixture).Execute()
})
g.Describe("started build", func() {
g.It("should build even with an empty source in build config", func() {
g.By("starting the build with --wait flag")
out, err := oc.Run("start-build").Args("nosrc-build", "--wait", fmt.Sprintf("--from-dir=%s", exampleBuild)).Output()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("verifying build success")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "nosrc-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
g.By(fmt.Sprintf("verifying the build %q status", out))
build, err := oc.REST().Builds(oc.Namespace()).Get("nosrc-build-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Spec.Source.Dockerfile).To(o.BeNil())
o.Expect(build.Spec.Source.Git).To(o.BeNil())
o.Expect(build.Spec.Source.Images).To(o.BeNil())
o.Expect(build.Spec.Source.Binary).NotTo(o.BeNil())
})
})
})