Skip to content

Commit

Permalink
more catching of build errors, dump of logs, etc.; add registry pod d…
Browse files Browse the repository at this point in the history
…isk usage analysis
  • Loading branch information
gabemontero committed May 5, 2016
1 parent d8e4a09 commit 31e2f20
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 40 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions images/dockerregistry/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ COPY bin/dockerregistry /dockerregistry
LABEL io.k8s.display-name="OpenShift Origin Image Registry" \
io.k8s.description="This is a component of OpenShift Origin and exposes a Docker registry that is integrated with the cluster for authentication and management."

RUN yum install -y quota && yum install -y audit && yum install -y xfsprogs

# The registry doesn't require a root user.
USER 1001
EXPOSE 5000
Expand Down
8 changes: 6 additions & 2 deletions test/extended/builds/docker_pullsecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ var _ = g.Describe("[builds][pullsecret][Conformance] docker build using a pull
g.By("expecting the build succeeds")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "docker-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
logs, _ := oc.Run("build-logs").Args("docker-build-1").Output()
logs, _ := oc.Run("logs").Args("-f", "bc/docker-build").Output()
exutil.ExamineDiskUsage()
exutil.ExaminePodDiskUsage(oc)
e2e.Failf("build failed: %s", logs)
}

Expand All @@ -55,7 +57,9 @@ var _ = g.Describe("[builds][pullsecret][Conformance] docker build using a pull
g.By("expecting the build succeeds")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "docker-build-pull-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
logs, _ := oc.Run("build-logs").Args("docker-build-pull-1").Output()
logs, _ := oc.Run("logs").Args("-f", "bc/docker-build-pull").Output()
exutil.ExamineDiskUsage()
exutil.ExaminePodDiskUsage(oc)
e2e.Failf("build failed: %s", logs)
}
})
Expand Down
3 changes: 3 additions & 0 deletions test/extended/builds/image_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ var _ = g.Describe("[builds][Slow] build can have Docker image source", func() {
o.Expect(err).NotTo(o.HaveOccurred())
g.By("expect the builds to complete successfully")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "imagedockerbuild-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("imagedockerbuild", oc)
}
o.Expect(err).NotTo(o.HaveOccurred())

g.By("expect the pod to deploy successfully")
Expand Down
8 changes: 6 additions & 2 deletions test/extended/builds/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ var _ = g.Describe("[builds][Slow] result image should have proper labels set",
g.By("o.Expecting the S2I build is in Complete phase")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), buildName, exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
logs, _ := oc.Run("build-logs").Args(buildName).Output()
logs, _ := oc.Run("logs").Args("-f", "bc/test").Output()
exutil.ExamineDiskUsage()
exutil.ExaminePodDiskUsage(oc)
e2e.Failf("build failed: %s", logs)
}

Expand Down Expand Up @@ -82,7 +84,9 @@ var _ = g.Describe("[builds][Slow] result image should have proper labels set",
g.By("o.Expecting the Docker build is in Complete phase")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), buildName, exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
logs, _ := oc.Run("build-logs").Args(buildName).Output()
logs, _ := oc.Run("logs").Args("-f", "bc/test").Output()
exutil.ExamineDiskUsage()
exutil.ExaminePodDiskUsage(oc)
e2e.Failf("build failed: %s", logs)
}

Expand Down
15 changes: 8 additions & 7 deletions test/extended/builds/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"

buildapi "github.com/openshift/origin/pkg/build/api"
exutil "github.com/openshift/origin/test/extended/util"
kapi "k8s.io/kubernetes/pkg/api"
)
Expand Down Expand Up @@ -49,9 +48,10 @@ var _ = g.Describe("[builds][Slow] can use build secrets", func() {
o.Expect(out).To(o.ContainSubstring("relative-secret3=secret3"))

g.By("checking the status of the build")
build, err := oc.REST().Builds(oc.Namespace()).Get("test-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "test-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("test", oc)
}

g.By("getting the image name")
image, err := exutil.GetDockerImageReference(oc.REST().ImageStreams(oc.Namespace()), "test", "latest")
Expand Down Expand Up @@ -86,9 +86,10 @@ var _ = g.Describe("[builds][Slow] can use build secrets", func() {
o.Expect(out).To(o.ContainSubstring("relative-secret2=secret2"))

g.By("checking the status of the build")
build, err := oc.REST().Builds(oc.Namespace()).Get("test-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "test-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("test", oc)
}
})

})
Expand Down
50 changes: 28 additions & 22 deletions test/extended/builds/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"

buildapi "github.com/openshift/origin/pkg/build/api"
exutil "github.com/openshift/origin/test/extended/util"
)

Expand All @@ -37,9 +36,10 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
o.Expect(err).NotTo(o.HaveOccurred())

g.By(fmt.Sprintf("verifying the build %q status", out))
build, err := oc.REST().Builds(oc.Namespace()).Get(out)
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "sample-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("sample-build", oc)
}
})

g.It("should start a build and wait for the build to fail", func() {
Expand All @@ -64,9 +64,10 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
o.Expect(out).To(o.ContainSubstring("BAR=test"))
o.Expect(out).To(o.ContainSubstring("VAR=test"))
g.By(fmt.Sprintf("verifying the build %q status", out))
build, err := oc.REST().Builds(oc.Namespace()).Get("sample-build-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "sample-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("sample-build", oc)
}
})

g.It("should allow to change build log level", func() {
Expand All @@ -76,9 +77,10 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
g.By(fmt.Sprintf("verifying the build output is not verbose"))
o.Expect(out).NotTo(o.ContainSubstring("Creating a new S2I builder"))
g.By(fmt.Sprintf("verifying the build %q status", out))
build, err := oc.REST().Builds(oc.Namespace()).Get("sample-build-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "sample-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("sample-build", oc)
}
})
})

Expand All @@ -92,9 +94,10 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
o.Expect(out).To(o.ContainSubstring("as binary input for the build ..."))
o.Expect(out).To(o.ContainSubstring("Your bundle is complete"))

build, err := oc.REST().Builds(oc.Namespace()).Get("sample-build-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "sample-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("sample-build", oc)
}
})

g.It("should accept --from-dir as input", func() {
Expand All @@ -106,9 +109,10 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
o.Expect(out).To(o.ContainSubstring("as binary input for the build ..."))
o.Expect(out).To(o.ContainSubstring("Your bundle is complete"))

build, err := oc.REST().Builds(oc.Namespace()).Get("sample-build-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "sample-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("sample-build", oc)
}
})

g.It("should accept --from-repo as input", func() {
Expand All @@ -121,9 +125,10 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
o.Expect(out).To(o.ContainSubstring("as binary input for the build ..."))
o.Expect(out).To(o.ContainSubstring("Your bundle is complete"))

build, err := oc.REST().Builds(oc.Namespace()).Get("sample-build-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "sample-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("sample-build", oc)
}
})

g.It("should accept --from-repo with --commit as input", func() {
Expand All @@ -139,9 +144,10 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
o.Expect(out).To(o.ContainSubstring("as binary input for the build ..."))
o.Expect(out).To(o.ContainSubstring("Your bundle is complete"))

build, err := oc.REST().Builds(oc.Namespace()).Get("sample-build-1")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseComplete))
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "sample-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("sample-build", oc)
}
})
})

Expand Down
2 changes: 1 addition & 1 deletion test/extended/images/sample_repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewSampleRepoTest(c SampleRepoConfig) func() {
g.By("expecting the build is in the Complete phase")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), buildName, exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
logs, _ := oc.Run("build-logs").Args(buildName).Output()
logs, _ := oc.Run("logs").Args("-f", "bc/"+c.buildConfigName).Output()
e2e.Failf("build failed: %s", logs)
}

Expand Down
8 changes: 8 additions & 0 deletions test/extended/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ function os::test::extended::setup {
{
out=$?
cleanup_openshift
echo GGM running xfs_quota reports
xfs_quota -xc 'report /dev/mapper/docker--vg-openshift--xfs--vol--dir'
xfs_quota -xc 'report /mnt/openshift-xfs-vol-dir'
echo "[INFO] Exiting"
return $out
}
Expand Down Expand Up @@ -92,6 +95,11 @@ function os::test::extended::setup {
if selinuxenabled; then
sudo chcon -t svirt_sandbox_file_t ${VOLUME_DIR}
fi

sudo yum install -y quota
sudo yum install -y audit
sudo yum install -y xfsprogs

configure_os_server

# Similar to above check, if the XFS volume dir mount point exists enable
Expand Down
Loading

0 comments on commit 31e2f20

Please sign in to comment.