Merge "additional configuration options for scenario tests"

This commit is contained in:
Zuul 2024-07-18 23:43:56 +00:00 committed by Gerrit Code Review
commit d9530e01fa
3 changed files with 28 additions and 5 deletions

View File

@ -334,6 +334,18 @@ ShareGroup = [
cfg.IntOpt("share_size",
default=1,
help="Default size in GB for shares created by share tests."),
cfg.IntOpt("additional_overflow_blocks",
default=0,
help="Additional blocks to be written "
"to share in scenario tests."),
cfg.IntOpt("share_resize_sync_delay",
default=0,
help="Time to wait before the changes to the share size"
" are propagated to the storage system."),
cfg.IntOpt("share_growth_size",
default=1,
help="The default increase in size sought by tests"
" when validating share resizing within scenario tests."),
cfg.BoolOpt("run_ipv6_tests",
default=False,
help="Enable or disable running IPv6 NFS scenario tests. "

View File

@ -9,6 +9,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import time
import ddt
from oslo_log import log as logging
@ -50,6 +51,8 @@ class ShareExtendBase(manager.ShareScenarioTest):
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
def test_create_extend_and_write(self):
default_share_size = CONF.share.share_size
additional_overflow_blocks = CONF.share.additional_overflow_blocks
share_growth_size = CONF.share.share_growth_size
LOG.debug('Step 1 - create instance')
instance = self.boot_instance(wait_until="BUILD")
@ -77,30 +80,36 @@ class ShareExtendBase(manager.ShareScenarioTest):
self.write_data_to_mounted_share_using_dd(remote_client,
'/mnt/t1', '64M',
three_quarter_blocks)
time.sleep(CONF.share.share_resize_sync_delay)
ls_result = remote_client.exec_command("sudo ls -lAh /mnt/")
LOG.debug(ls_result)
over_one_quarter_blocks = total_blocks - three_quarter_blocks + 5
# Additional blocks that exceed the share capacity, defaulting to 5.
overflow_blocks = (
total_blocks - three_quarter_blocks +
additional_overflow_blocks or 5)
LOG.debug('Step 6b - Write more data, should fail')
self.assertRaises(
exceptions.SSHExecCommandFailed,
self.write_data_to_mounted_share_using_dd,
remote_client, '/mnt/t2', '64M', over_one_quarter_blocks)
remote_client, '/mnt/t2', '64M', overflow_blocks)
time.sleep(CONF.share.share_resize_sync_delay)
ls_result = remote_client.exec_command("sudo ls -lAh /mnt/")
LOG.debug(ls_result)
LOG.debug('Step 7 - extend and wait')
extended_share_size = default_share_size + 1
extended_share_size = default_share_size + share_growth_size
self.shares_v2_client.extend_share(share["id"],
new_size=extended_share_size)
waiters.wait_for_resource_status(
self.shares_v2_client, share["id"], constants.STATUS_AVAILABLE)
share = self.shares_v2_client.get_share(share["id"])['share']
self.assertEqual(extended_share_size, int(share["size"]))
time.sleep(CONF.share.share_resize_sync_delay)
LOG.debug('Step 8 - writing more data, should succeed')
self.write_data_with_remount(location, remote_client, '/mnt/t3',
'64M', over_one_quarter_blocks)
'64M', overflow_blocks)
ls_result = remote_client.exec_command("sudo ls -lAh /mnt/")
LOG.debug(ls_result)

View File

@ -80,6 +80,7 @@ class ShareShrinkBase(manager.ShareScenarioTest):
self.write_data_to_mounted_share_using_dd(remote_client,
'/mnt/t1', '64M',
blocks)
time.sleep(CONF.share.share_resize_sync_delay)
ls_result = remote_client.exec_command("sudo ls -lAh /mnt/")
LOG.debug(ls_result)
@ -117,10 +118,11 @@ class ShareShrinkBase(manager.ShareScenarioTest):
self.assertEqual(default_share_size, int(share["size"]))
LOG.debug('Step 11 - write more data than allocated, should fail')
overflow_blocks = blocks + CONF.share.additional_overflow_blocks
self.assertRaises(
exceptions.SSHExecCommandFailed,
self.write_data_to_mounted_share_using_dd,
remote_client, '/mnt/t1', '64M', blocks)
remote_client, '/mnt/t1', '64M', overflow_blocks)
LOG.debug('Step 12 - unmount')
self.unmount_share(remote_client)