From 51d9728b0d64a6136a3690ef3c93e669df1a7092 Mon Sep 17 00:00:00 2001 From: "Andrei V. Ostapenko" Date: Wed, 4 Feb 2015 14:13:12 +0200 Subject: [PATCH] Adds tempest test on batch write with 2 tables 1 nonexistent Related to bug #1328888 Change-Id: I0380c5ec1411793501e9a2e81ef0183ad79fb2c6 --- .../keyvalue/stable/rest/test_batch_write.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/contrib/tempest/tempest/api/keyvalue/stable/rest/test_batch_write.py b/contrib/tempest/tempest/api/keyvalue/stable/rest/test_batch_write.py index 0da48af5..f4db0066 100644 --- a/contrib/tempest/tempest/api/keyvalue/stable/rest/test_batch_write.py +++ b/contrib/tempest/tempest/api/keyvalue/stable/rest/test_batch_write.py @@ -401,3 +401,33 @@ class MagnetoDBBatchWriteTest(MagnetoDBTestCase): error_msg = raises_cm.exception._error_string self.assertIn("Bad Request", error_msg) self.assertIn("Wrong attribute name '' found", error_msg) + + @attr(type=['negative']) + def test_batch_write_two_tables_one_nonexistent(self): + non_existent_table = rand_name(self.table_prefix).replace('-', '') + self._create_test_table(self.build_x_attrs('S'), + self.tname, + self.smoke_schema, + wait_for_active=True) + item = self.build_x_item('S', 'forum1', 'subject2', + ('message', 'S', 'message text')) + request_body = {'request_items': { + self.tname: [{ + 'put_request': {'item': item}}], + non_existent_table: [{ + 'put_request': {'item': item}}], + }} + with self.assertRaises(exceptions.NotFound) as raises_cm: + self.client.batch_write_item(request_body) + error_msg = raises_cm.exception._error_string + self.assertIn("TableNotExistsException", error_msg) + key_conditions = { + self.hashkey: { + 'attribute_value_list': [{'S': 'forum1'}], + 'comparison_operator': 'EQ' + } + } + headers, body = self.client.query(self.tname, + key_conditions=key_conditions, + consistent_read=True) + self.assertEqual([], body['items'])