From ba3088c4ee2415c44673eb0b82e45ed0aa5e7df2 Mon Sep 17 00:00:00 2001 From: Goutham Pacha Ravi Date: Thu, 2 Feb 2017 18:10:35 -0500 Subject: [PATCH] Fix wrong access-rule negative test The test test_add_access_rule_on_share_with_no_host in manila_tempest_tests.tests.api.test_rules_negative\ .ShareIpRulesForNFSNegativeTest expects a share to fail to schedule, and then validates that an access rule cannot be added. However, the share may still be 'creating' when the access change is being attempted. While the test passes (access rules cannot be added when the share status isn't 'available'), the intent of that particular test is to ensure access rules cannot be added when the share has no host. This fixes the cleanup error that happens in consequence, because we don't allow deleting shares that are in 'creating' state. In the spirit of true black box testing, we should ensure that the share fails to schedule before attempting this test. Change-Id: Id150e0ef546ddfd40d97d9b1a54fd8ba23028720 Closes-Bug: #1661421 --- manila_tempest_tests/tests/api/test_rules_negative.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manila_tempest_tests/tests/api/test_rules_negative.py b/manila_tempest_tests/tests/api/test_rules_negative.py index 20db4ebe1d..8049f1445e 100644 --- a/manila_tempest_tests/tests/api/test_rules_negative.py +++ b/manila_tempest_tests/tests/api/test_rules_negative.py @@ -19,6 +19,7 @@ from tempest.lib import exceptions as lib_exc import testtools from testtools import testcase as tc +from manila_tempest_tests.common import constants from manila_tempest_tests.tests.api import base from manila_tempest_tests import utils @@ -166,12 +167,14 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesMixedTest): {"share_backend_name": 'invalid_backend'}) share_type = self.create_share_type('invalid_backend', extra_specs=extra_specs, - client=self.admin_client) + client=self.admin_client, + cleanup_in_class=False) share_type = share_type['share_type'] share = self.create_share(share_type_id=share_type['id'], - client=self.admin_client, cleanup_in_class=False, wait_for_status=False) + self.shares_v2_client.wait_for_share_status( + share['id'], constants.STATUS_ERROR) self.assertRaises(lib_exc.BadRequest, self.admin_client.create_access_rule, share["id"], access_type, access_to)