summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-10-15 15:43:49 -0700
committerGreg Farnum <greg@inktank.com>2013-10-17 13:11:46 -0700
commit22958375e182318be1525464306f0dd2f68624a8 (patch)
treeecd7bafb92d9ddfe32561bfc1b7d2766810371e0
parent2478d55ebf6209bb8791f050225fac8fe17532bb (diff)
downloadceph-22958375e182318be1525464306f0dd2f68624a8.tar.gz
workunits: break down cache pool tests to be more precise; expand some
Signed-off-by: Greg Farnum <greg@inktank.com>
-rwxr-xr-xqa/workunits/rados/caching_redirects.sh63
1 files changed, 41 insertions, 22 deletions
diff --git a/qa/workunits/rados/caching_redirects.sh b/qa/workunits/rados/caching_redirects.sh
index 6b2b201af16..b6007bf0cab 100755
--- a/qa/workunits/rados/caching_redirects.sh
+++ b/qa/workunits/rados/caching_redirects.sh
@@ -11,22 +11,22 @@ expect_false()
#create pools, set up tier relationship
ceph osd pool create base_pool 2
-ceph osd pool create partial_cache 2
-ceph osd pool create data_cache 2
-ceph osd tier add base_pool partial_cache
-ceph osd tier add base_pool data_cache
+ceph osd pool create partial_wrong 2
+ceph osd pool create wrong_cache 2
+ceph osd tier add base_pool partial_wrong
+ceph osd tier add base_pool wrong_cache
-# populate base_pool and data_cache with some data
+# populate base_pool with some data
echo "foo" > foo.txt
echo "bar" > bar.txt
echo "baz" > baz.txt
rados -p base_pool put fooobj foo.txt
rados -p base_pool put barobj bar.txt
-# data_cache is backwards so we can tell we read from it
-rados -p data_cache put fooobj bar.txt
-rados -p data_cache put barobj foo.txt
-# partial_cache gets barobj backwards
-rados -p partial_cache put barobj foo.txt
+# fill in wrong_cache backwards so we can tell we read from it
+rados -p wrong_cache put fooobj bar.txt
+rados -p wrong_cache put barobj foo.txt
+# partial_wrong gets barobj backwards so we can check promote and non-promote
+rados -p partial_wrong put barobj foo.txt
# get the objects back before setting a caching pool
rados -p base_pool get fooobj tmp.txt
@@ -34,25 +34,25 @@ diff -q tmp.txt foo.txt
rados -p base_pool get barobj tmp.txt
diff -q tmp.txt bar.txt
-# set up redirect and make sure we get redirect-based results
-ceph osd tier set-overlay base_pool partial_cache
-ceph osd tier cache-mode partial_cache writeback
+# set up redirect and make sure we get backwards results
+ceph osd tier set-overlay base_pool wrong_cache
+ceph osd tier cache-mode wrong_cache writeback
rados -p base_pool get fooobj tmp.txt
-diff -q tmp.txt foo.txt
+diff -q tmp.txt bar.txt
rados -p base_pool get barobj tmp.txt
diff -q tmp.txt foo.txt
-# try a nonexistent object and make sure we get an error
-expect_false rados -p base_pool get bazobj tmp.txt
-
-# switch cache pools and make sure contents differ
+# switch cache pools and make sure we're doing promote
ceph osd tier remove-overlay base_pool
-ceph osd tier set-overlay base_pool data_cache
-ceph osd tier cache-mode data_cache writeback
+ceph osd tier set-overlay base_pool partial_wrong
+ceph osd tier cache-mode partial_wrong writeback
rados -p base_pool get fooobj tmp.txt
-diff -q tmp.txt bar.txt
+diff -q tmp.txt foo.txt # hurray, it promoted!
rados -p base_pool get barobj tmp.txt
-diff -q tmp.txt foo.txt
+diff -q tmp.txt foo.txt # yep, we read partial_wrong's local object!
+
+# try a nonexistent object and make sure we get an error
+expect_false rados -p base_pool get bazobj tmp.txt
# drop the cache entirely and make sure contents are still the same
ceph osd tier remove-overlay base_pool
@@ -60,3 +60,22 @@ rados -p base_pool get fooobj tmp.txt
diff -q tmp.txt foo.txt
rados -p base_pool get barobj tmp.txt
diff -q tmp.txt bar.txt
+
+# create an empty cache pool and make sure it has objects after reading
+ceph osd pool create empty_cache 2
+
+touch empty.txt
+rados -p empty_cache ls > tmp.txt
+diff -q tmp.txt empty.txt
+
+ceph osd tier add base_pool empty_cache
+ceph osd tier set-overlay base_pool empty_cache
+ceph osd tier cache-mode empty_cache writeback
+rados -p base_pool get fooobj tmp.txt
+rados -p base_pool get barobj tmp.txt
+expect_false rados -p base_pool get bazobj tmp.txt
+
+rados -p empty_cache ls > tmp.txt
+expect_false diff -q tmp.txt empty.txt
+rados -p base_pool ls > tmp2.txt
+diff -q tmp.txt tmp2.txt \ No newline at end of file