From 9883fb3533fcea5c436cb473fa0643cdac1591ec Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Fri, 20 Mar 2015 10:20:35 -0400 Subject: Add configuration-time checks for invalid collators. --- test/suite/test_bug012.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test/suite/test_bug012.py (limited to 'test') diff --git a/test/suite/test_bug012.py b/test/suite/test_bug012.py new file mode 100644 index 00000000000..9787ed0d7da --- /dev/null +++ b/test/suite/test_bug012.py @@ -0,0 +1,42 @@ +#!usr/bin/env python +# +# Public Domain 2014-2015 MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +import wiredtiger, wttest + +# test_bug012.py +class test_bug012(wttest.WiredTigerTestCase): + + # Test that we detect illegal collators. + def test_illegal_collator(self): + msg = '/unknown collator/' + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.create('table:A', + 'type=lsm,lsm=(bloom_config=(collator="foo"))'), msg) + +if __name__ == '__main__': + wttest.run() -- cgit v1.2.1 From 94d3e1ff61eeff4801a64cc6f753eeb7a8eb9650 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Fri, 20 Mar 2015 10:31:28 -0400 Subject: Add tests for illegal key/value format configurations. --- test/suite/test_bug012.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/suite/test_bug012.py b/test/suite/test_bug012.py index 9787ed0d7da..0ffcf03906e 100644 --- a/test/suite/test_bug012.py +++ b/test/suite/test_bug012.py @@ -38,5 +38,19 @@ class test_bug012(wttest.WiredTigerTestCase): lambda: self.session.create('table:A', 'type=lsm,lsm=(bloom_config=(collator="foo"))'), msg) + # Test that we detect illegal key formats. + def test_illegal_key_format(self): + msg = '/Invalid type/' + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.create('table:A', + 'type=lsm,lsm=(bloom_config=(key_format="X"))'), msg) + + # Test that we detect illegal value formats. + def test_illegal_value_format(self): + msg = '/Invalid type/' + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.create('table:A', + 'type=lsm,lsm=(bloom_config=(value_format="X"))'), msg) + if __name__ == '__main__': wttest.run() -- cgit v1.2.1 From e9bd34719860356f9bcac88a9d8ca6848aeb7855 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Fri, 20 Mar 2015 10:49:41 -0400 Subject: Add tests for illegal block compressors. --- test/suite/test_bug012.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/suite/test_bug012.py b/test/suite/test_bug012.py index 0ffcf03906e..63e0f17e52f 100644 --- a/test/suite/test_bug012.py +++ b/test/suite/test_bug012.py @@ -36,21 +36,28 @@ class test_bug012(wttest.WiredTigerTestCase): msg = '/unknown collator/' self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.session.create('table:A', - 'type=lsm,lsm=(bloom_config=(collator="foo"))'), msg) + 'type=lsm,lsm=(bloom_config=(collator="xyzzy"))'), msg) # Test that we detect illegal key formats. def test_illegal_key_format(self): msg = '/Invalid type/' self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.session.create('table:A', - 'type=lsm,lsm=(bloom_config=(key_format="X"))'), msg) + 'type=lsm,lsm=(bloom_config=(key_format="xyzzy"))'), msg) # Test that we detect illegal value formats. def test_illegal_value_format(self): msg = '/Invalid type/' self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.session.create('table:A', - 'type=lsm,lsm=(bloom_config=(value_format="X"))'), msg) + 'type=lsm,lsm=(bloom_config=(value_format="xyzzy"))'), msg) + + # Test that we detect illegal compressors. + def test_illegal_compressor(self): + msg = '/unknown block compressor/' + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.create('table:A', + 'type=lsm,lsm=(bloom_config=(block_compressor="xyzzy"))'), msg) if __name__ == '__main__': wttest.run() -- cgit v1.2.1 From dbc9f638f24a358173472e2e7f000f624e32f468 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Fri, 20 Mar 2015 11:05:51 -0400 Subject: Add a test for invalid extractors --- test/suite/test_bug012.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/suite/test_bug012.py b/test/suite/test_bug012.py index 63e0f17e52f..2761049e122 100644 --- a/test/suite/test_bug012.py +++ b/test/suite/test_bug012.py @@ -59,5 +59,12 @@ class test_bug012(wttest.WiredTigerTestCase): lambda: self.session.create('table:A', 'type=lsm,lsm=(bloom_config=(block_compressor="xyzzy"))'), msg) + # Test that we detect illegal extractors. + def test_illegal_extractor(self): + msg = '/unknown extractor/' + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: self.session.create('table:A', + 'type=lsm,lsm=(bloom_config=(extractor="xyzzy"))'), msg) + if __name__ == '__main__': wttest.run() -- cgit v1.2.1 From 377f9e593f74a11b649e072f52035e0cf842248e Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Fri, 20 Mar 2015 11:59:09 -0400 Subject: Btree & log share a compressor, make the error message general. --- test/suite/test_bug012.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/suite/test_bug012.py b/test/suite/test_bug012.py index 2761049e122..5621e91ac30 100644 --- a/test/suite/test_bug012.py +++ b/test/suite/test_bug012.py @@ -54,7 +54,7 @@ class test_bug012(wttest.WiredTigerTestCase): # Test that we detect illegal compressors. def test_illegal_compressor(self): - msg = '/unknown block compressor/' + msg = '/unknown compressor/' self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.session.create('table:A', 'type=lsm,lsm=(bloom_config=(block_compressor="xyzzy"))'), msg) -- cgit v1.2.1