Skip to content

Commit

Permalink
extended tests: add OOMKilled build test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Wozniak committed Jul 13, 2018
1 parent a9c8e88 commit 31871e1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/extended/builds/failure_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var _ = g.Describe("[Feature:Builds][Slow] update failure status", func() {
fetchDockerSrc = exutil.FixturePath("testdata", "builds", "statusfail-fetchsourcedocker.yaml")
fetchS2ISrc = exutil.FixturePath("testdata", "builds", "statusfail-fetchsources2i.yaml")
badContextDirS2ISrc = exutil.FixturePath("testdata", "builds", "statusfail-badcontextdirs2i.yaml")
oomkilled = exutil.FixturePath("testdata", "builds", "statusfail-oomkilled.yaml")
builderImageFixture = exutil.FixturePath("testdata", "builds", "statusfail-fetchbuilderimage.yaml")
pushToRegistryFixture = exutil.FixturePath("testdata", "builds", "statusfail-pushtoregistry.yaml")
failedAssembleFixture = exutil.FixturePath("testdata", "builds", "statusfail-failedassemble.yaml")
Expand Down Expand Up @@ -130,6 +131,25 @@ var _ = g.Describe("[Feature:Builds][Slow] update failure status", func() {
})
})

g.Describe("Build status OutOfMemoryKilled", func() {
g.It("should contain OutOfMemoryKilled failure reason and message", func() {
err := oc.Run("create").Args("-f", oomkilled).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

br, err := exutil.StartBuildAndWait(oc, "statusfail-oomkilled", "--build-loglevel=5")
o.Expect(err).NotTo(o.HaveOccurred())
br.AssertFailure()
br.DumpLogs()

build, err := oc.BuildClient().Build().Builds(oc.Namespace()).Get(br.Build.Name, metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Reason).To(o.Equal(buildapi.StatusReasonOutOfMemoryKilled))
o.Expect(build.Status.Message).To(o.Equal(buildapi.StatusMessageOutOfMemoryKilled))

exutil.CheckForBuildEvent(oc.KubeClient().Core(), br.Build, buildapi.BuildFailedEventReason, buildapi.BuildFailedEventMessage)
})
})

g.Describe("Build status S2I bad context dir failure", func() {
g.It("should contain the S2I bad context dir failure reason and message", func() {
err := oc.Run("create").Args("-f", badContextDirS2ISrc).Execute()
Expand Down
17 changes: 17 additions & 0 deletions test/extended/testdata/builds/statusfail-oomkilled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kind: BuildConfig
apiVersion: v1
metadata:
name: statusfail-oomkilled
spec:
resources:
limits:
memory: 10Mi
source:
git:
uri: "https://github.com/openshift/ruby-hello-world"
strategy:
type: Source
sourceStrategy:
from:
kind: DockerImage
name: centos/ruby-23-centos7:latest

0 comments on commit 31871e1

Please sign in to comment.