forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove_buildconfig.go
70 lines (58 loc) · 1.85 KB
/
remove_buildconfig.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package builds
import (
"time"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/util/wait"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[Feature:Builds][Conformance] remove all builds when build configuration is removed", func() {
defer g.GinkgoRecover()
var (
buildFixture = exutil.FixturePath("testdata", "builds", "test-build.json")
oc = exutil.NewCLI("cli-remove-build", exutil.KubeConfigPath())
)
g.Context("", func() {
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeClient().Core().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
oc.Run("create").Args("-f", buildFixture).Execute()
})
g.AfterEach(func() {
if g.CurrentGinkgoTestDescription().Failed {
exutil.DumpPodStates(oc)
exutil.DumpPodLogsStartingWith("", oc)
}
})
g.Describe("oc delete buildconfig", func() {
g.It("should start builds and delete the buildconfig", func() {
var (
err error
builds [4]string
)
g.By("starting multiple builds")
for i := range builds {
stdout, _, err := exutil.StartBuild(oc, "sample-build", "-o=name")
o.Expect(err).NotTo(o.HaveOccurred())
builds[i] = stdout
}
g.By("deleting the buildconfig")
err = oc.Run("delete").Args("bc/sample-build").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("waiting for builds to clear")
err = wait.Poll(3*time.Second, 3*time.Minute, func() (bool, error) {
out, err := oc.Run("get").Args("builds").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if out == "No resources found." {
return true, nil
}
return false, nil
})
if err == wait.ErrWaitTimeout {
g.Fail("timed out waiting for builds to clear")
}
})
})
})
})