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
This commit is contained in:
Goutham Pacha Ravi 2017-02-02 18:10:35 -05:00
parent 6b4171bff2
commit ba3088c4ee
1 changed files with 5 additions and 2 deletions

View File

@ -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)