-
Notifications
You must be signed in to change notification settings - Fork 0
/
s2i_quota.go
60 lines (49 loc) · 2.1 KB
/
s2i_quota.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
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][Conformance] s2i build with a quota", func() {
defer g.GinkgoRecover()
const (
buildTestPod = "build-test-pod"
buildTestService = "build-test-svc"
)
var (
buildFixture = exutil.FixturePath("testdata", "test-s2i-build-quota.json")
oc = exutil.NewCLI("s2i-build-quota", exutil.KubeConfigPath())
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.AdminKubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("Building from a template", func() {
g.It("should create an s2i build with a quota and run it", func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
g.By(fmt.Sprintf("calling oc create -f %q", buildFixture))
err := oc.Run("create").Args("-f", buildFixture).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("starting a test build")
out, err := oc.Run("start-build").Args("s2i-build-quota", "--from-dir", exutil.FixturePath("testdata", "build-quota")).Output()
fmt.Fprintf(g.GinkgoWriter, "\nstart-build output:\n%s\n", out)
o.Expect(err).NotTo(o.HaveOccurred())
g.By("expecting the build is in Complete phase")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "s2i-build-quota-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("s2i-build-quota", oc)
}
o.Expect(err).NotTo(o.HaveOccurred())
g.By("expecting the build logs to contain the correct cgroups values")
buildLog, err := oc.Run("logs").Args(fmt.Sprintf("build/s2i-build-quota-1")).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(buildLog).To(o.ContainSubstring("MEMORY=209715200"))
o.Expect(buildLog).To(o.ContainSubstring("MEMORYSWAP=209715200"))
o.Expect(buildLog).To(o.ContainSubstring("SHARES=61"))
o.Expect(buildLog).To(o.ContainSubstring("PERIOD=100000"))
o.Expect(buildLog).To(o.ContainSubstring("QUOTA=6000"))
})
})
})