Skip to content

Commit 01eab5b

Browse files
author
Jan Wozniak
committed
extended tests: add OOMKilled build test
1 parent a7acc5b commit 01eab5b

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

test/extended/builds/failure_status.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var _ = g.Describe("[Feature:Builds][Slow] update failure status", func() {
2727
fetchDockerSrc = exutil.FixturePath("testdata", "builds", "statusfail-fetchsourcedocker.yaml")
2828
fetchS2ISrc = exutil.FixturePath("testdata", "builds", "statusfail-fetchsources2i.yaml")
2929
badContextDirS2ISrc = exutil.FixturePath("testdata", "builds", "statusfail-badcontextdirs2i.yaml")
30+
oomkilled = exutil.FixturePath("testdata", "builds", "statusfail-oomkilled.yaml")
3031
builderImageFixture = exutil.FixturePath("testdata", "builds", "statusfail-fetchbuilderimage.yaml")
3132
pushToRegistryFixture = exutil.FixturePath("testdata", "builds", "statusfail-pushtoregistry.yaml")
3233
failedAssembleFixture = exutil.FixturePath("testdata", "builds", "statusfail-failedassemble.yaml")
@@ -130,6 +131,32 @@ var _ = g.Describe("[Feature:Builds][Slow] update failure status", func() {
130131
})
131132
})
132133

134+
g.Describe("Build status OutOfMemoryKilled", func() {
135+
g.It("should contain OutOfMemoryKilled failure reason and message", func() {
136+
err := oc.Run("create").Args("-f", oomkilled).Execute()
137+
o.Expect(err).NotTo(o.HaveOccurred())
138+
139+
br, err := exutil.StartBuildAndWait(oc, "statusfail-oomkilled", "--build-loglevel=5")
140+
o.Expect(err).NotTo(o.HaveOccurred())
141+
br.AssertFailure()
142+
br.DumpLogs()
143+
144+
var build *buildapi.Build
145+
wait.PollImmediate(200*time.Millisecond, 30*time.Second, func() (bool, error) {
146+
build, err = oc.BuildClient().Build().Builds(oc.Namespace()).Get(br.Build.Name, metav1.GetOptions{})
147+
if build.Status.Reason != buildapi.StatusReasonOutOfMemoryKilled {
148+
return false, nil
149+
}
150+
return true, nil
151+
})
152+
o.Expect(err).NotTo(o.HaveOccurred())
153+
o.Expect(build.Status.Reason).To(o.Equal(buildapi.StatusReasonOutOfMemoryKilled))
154+
o.Expect(build.Status.Message).To(o.Equal(buildapi.StatusMessageOutOfMemoryKilled))
155+
156+
exutil.CheckForBuildEvent(oc.KubeClient().Core(), br.Build, buildapi.BuildFailedEventReason, buildapi.BuildFailedEventMessage)
157+
})
158+
})
159+
133160
g.Describe("Build status S2I bad context dir failure", func() {
134161
g.It("should contain the S2I bad context dir failure reason and message", func() {
135162
err := oc.Run("create").Args("-f", badContextDirS2ISrc).Execute()

test/extended/testdata/bindata.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: BuildConfig
2+
apiVersion: v1
3+
metadata:
4+
name: statusfail-oomkilled
5+
spec:
6+
resources:
7+
limits:
8+
memory: 10Mi
9+
source:
10+
git:
11+
uri: "https://github.com/openshift/ruby-hello-world"
12+
strategy:
13+
type: Source
14+
sourceStrategy:
15+
from:
16+
kind: DockerImage
17+
name: centos/ruby-23-centos7:latest

0 commit comments

Comments
 (0)