From: Sage Weil Date: Mon, 25 Aug 2014 17:18:43 +0000 (-0700) Subject: ceph_test_rados_api_tier: make PromoteOn2ndRead test tolerate retries X-Git-Tag: v0.85~11^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2320%2Fhead;p=ceph.git ceph_test_rados_api_tier: make PromoteOn2ndRead test tolerate retries If there is an ill-timed connection reset our read could get sent twice. Weaken our assertion if the read was slow to tolerate this case. Fixes: #9221 Signed-off-by: Sage Weil --- diff --git a/src/test/librados/tier.cc b/src/test/librados/tier.cc index ad30d2516c21..a43fcfedaebd 100644 --- a/src/test/librados/tier.cc +++ b/src/test/librados/tier.cc @@ -2122,15 +2122,25 @@ TEST_F(LibRadosTwoPoolsPP, PromoteOn2ndRead) { cluster.wait_for_latest_osdmap(); // 1st read, don't trigger a promote + utime_t start = ceph_clock_now(NULL); { bufferlist bl; ASSERT_EQ(1, ioctx.read("foo", bl, 1, 0)); } + utime_t end = ceph_clock_now(NULL); + float dur = end - start; + cout << "duration " << dur << std::endl; // verify the object is NOT present in the cache tier { ObjectIterator it = cache_ioctx.objects_begin(); - ASSERT_TRUE(it == cache_ioctx.objects_end()); + if (it != cache_ioctx.objects_end()) { + if (dur > 1.0) { + cout << " object got promoted, but read was slow, ignoring" << std::endl; + } else { + ASSERT_TRUE(it == cache_ioctx.objects_end()); + } + } } // Read until the object is present in the cache tier @@ -4072,15 +4082,25 @@ TEST_F(LibRadosTwoPoolsECPP, PromoteOn2ndRead) { cluster.wait_for_latest_osdmap(); // 1st read, don't trigger a promote + utime_t start = ceph_clock_now(NULL); { bufferlist bl; ASSERT_EQ(1, ioctx.read("foo", bl, 1, 0)); } + utime_t end = ceph_clock_now(NULL); + float dur = end - start; + cout << "duration " << dur << std::endl; // verify the object is NOT present in the cache tier { ObjectIterator it = cache_ioctx.objects_begin(); - ASSERT_TRUE(it == cache_ioctx.objects_end()); + if (it != cache_ioctx.objects_end()) { + if (dur > 1.0) { + cout << " object got promoted, but read was slow, ignoring" << std::endl; + } else { + ASSERT_TRUE(it == cache_ioctx.objects_end()); + } + } } // Read until the object is present in the cache tier