From 75cc26fb65ad92a604160f5cef22e852c8024803 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Thu, 19 Oct 2017 14:29:58 +0200 Subject: [PATCH] Allow Ceph server some time to start Ceph server needs to create our "foo" volume on startup. It keeps the image small, however it makes the server container start slow. Add sleep before the server is usable. Without this PR, all pods that use Ceph fail to start for couple of seconds with cryptic "image foo not found" error and it clutters logs and pod logs and makes it harder to spot real errors. --- test/e2e/framework/volume_util.go | 11 +++++++++++ test/e2e/storage/volumes.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/e2e/framework/volume_util.go b/test/e2e/framework/volume_util.go index 84214a15ab4..08d392b3a2b 100644 --- a/test/e2e/framework/volume_util.go +++ b/test/e2e/framework/volume_util.go @@ -72,6 +72,9 @@ const ( MiB int64 = 1024 * KiB GiB int64 = 1024 * MiB TiB int64 = 1024 * GiB + + // Waiting period for volume server (Ceph, ...) to initialize itself. + VolumeServerPodStartupSleep = 20 * time.Second ) // Configuration of one tests. The test consist of: @@ -196,6 +199,14 @@ func NewRBDServer(cs clientset.Interface, namespace string) (config VolumeTestCo }, } pod, ip = CreateStorageServer(cs, config) + + // Ceph server container needs some time to start. Tests continue working if + // this sleep is removed, however kubelet logs (and kubectl describe + // ) would be cluttered with error messages about non-existing + // image. + Logf("sleeping a bit to give ceph server time to initialize") + time.Sleep(VolumeServerPodStartupSleep) + return config, pod, ip } diff --git a/test/e2e/storage/volumes.go b/test/e2e/storage/volumes.go index f3bfc0f2be4..c8b505fb360 100644 --- a/test/e2e/storage/volumes.go +++ b/test/e2e/storage/volumes.go @@ -288,7 +288,7 @@ var _ = SIGDescribe("Volumes", func() { }() _, serverIP := framework.CreateStorageServer(cs, config) By("sleeping a bit to give ceph server time to initialize") - time.Sleep(20 * time.Second) + time.Sleep(framework.VolumeServerPodStartupSleep) // create ceph secret secret := &v1.Secret{