Merge "Remove experimental flag from share groups feature"
diff --git a/manila_tempest_tests/tests/api/admin/test_user_messages.py b/manila_tempest_tests/tests/api/admin/test_user_messages.py
index 9d69f90..83c5e37 100644
--- a/manila_tempest_tests/tests/api/admin/test_user_messages.py
+++ b/manila_tempest_tests/tests/api/admin/test_user_messages.py
@@ -124,7 +124,7 @@
         time_1 = created_at_1 - datetime.timedelta(seconds=1)
         time_2 = created_at_2 - datetime.timedelta(seconds=1)
 
-        params1 = {'created_since': str(created_at_1)}
+        params1 = {'created_since': str(time_1)}
         # should return all user messages created by this test including
         # self.message
         messages = self.shares_v2_client.list_messages(params=params1)
@@ -132,6 +132,10 @@
         self.assertGreaterEqual(len(ids), 2)
         self.assertIn(self.message['id'], ids)
         self.assertIn(new_message['id'], ids)
+        for message in messages:
+            time_diff_with_created_since = timeutils.delta_seconds(
+                time_1, timeutils.parse_strtime(message['created_at']))
+            self.assertGreaterEqual(time_diff_with_created_since, 0)
 
         params2 = {'created_since': str(time_1),
                    'created_before': str(time_2)}
@@ -143,6 +147,13 @@
         self.assertGreaterEqual(len(ids), 1)
         self.assertIn(self.message['id'], ids)
         self.assertNotIn(new_message['id'], ids)
+        for message in messages:
+            time_diff_with_created_since = timeutils.delta_seconds(
+                time_1, timeutils.parse_strtime(message['created_at']))
+            time_diff_with_created_before = timeutils.delta_seconds(
+                time_2, timeutils.parse_strtime(message['created_at']))
+            self.assertGreaterEqual(time_diff_with_created_since, 0)
+            self.assertGreaterEqual(0, time_diff_with_created_before)
 
         params3 = {'created_before': str(time_2)}
         # should not include self.message
@@ -151,3 +162,7 @@
         self.assertGreaterEqual(len(ids), 1)
         self.assertNotIn(new_message['id'], ids)
         self.assertIn(self.message['id'], ids)
+        for message in messages:
+            time_diff_with_created_before = timeutils.delta_seconds(
+                time_2, timeutils.parse_strtime(message['created_at']))
+            self.assertGreaterEqual(0, time_diff_with_created_before)
diff --git a/manila_tempest_tests/tests/api/test_quotas.py b/manila_tempest_tests/tests/api/test_quotas.py
index d7137f5..32152e0 100644
--- a/manila_tempest_tests/tests/api/test_quotas.py
+++ b/manila_tempest_tests/tests/api/test_quotas.py
@@ -82,15 +82,13 @@
             self.assertGreater(int(quotas["replica_gigabytes"]), -2)
 
     @ddt.data(
-        *itertools.product(set(("2.25", CONF.share.max_api_microversion)),
-                           (True, False)),
-        *itertools.product(set(("2.53", CONF.share.max_api_microversion)),
-                           (True, False))
+        *itertools.product(set(
+            ["2.25", "2.53", CONF.share.max_api_microversion]), (True, False))
     )
     @ddt.unpack
     @tc.attr(base.TAG_POSITIVE, base.TAG_API)
-    @base.skip_if_microversion_not_supported("2.25")
     def test_show_quotas_detail(self, microversion, with_user):
+        self.skip_if_microversion_not_supported(microversion)
         quota_args = {"tenant_id": self.tenant_id, "version": microversion, }
         keys = ['gigabytes', 'snapshot_gigabytes', 'shares',
                 'snapshots', 'share_networks']
diff --git a/manila_tempest_tests/tests/api/test_rules.py b/manila_tempest_tests/tests/api/test_rules.py
index dc63429..7ad57a9 100644
--- a/manila_tempest_tests/tests/api/test_rules.py
+++ b/manila_tempest_tests/tests/api/test_rules.py
@@ -81,12 +81,16 @@
     protocol = "nfs"
 
     @classmethod
-    def resource_setup(cls):
-        super(ShareIpRulesForNFSTest, cls).resource_setup()
+    def skip_checks(cls):
+        super(ShareIpRulesForNFSTest, cls).skip_checks()
         if (cls.protocol not in CONF.share.enable_protocols or
                 cls.protocol not in CONF.share.enable_ip_rules_for_protocols):
             msg = "IP rule tests for %s protocol are disabled" % cls.protocol
             raise cls.skipException(msg)
+
+    @classmethod
+    def resource_setup(cls):
+        super(ShareIpRulesForNFSTest, cls).resource_setup()
         # create share type
         cls.share_type = cls._create_share_type()
         cls.share_type_id = cls.share_type['id']
@@ -230,13 +234,18 @@
     protocol = "nfs"
 
     @classmethod
-    def resource_setup(cls):
-        super(ShareUserRulesForNFSTest, cls).resource_setup()
+    def skip_checks(cls):
+        super(ShareUserRulesForNFSTest, cls).skip_checks()
         if (cls.protocol not in CONF.share.enable_protocols or
                 cls.protocol not in
                 CONF.share.enable_user_rules_for_protocols):
             msg = "USER rule tests for %s protocol are disabled" % cls.protocol
             raise cls.skipException(msg)
+
+    @classmethod
+    def resource_setup(cls):
+        super(ShareUserRulesForNFSTest, cls).resource_setup()
+
         # create share type
         cls.share_type = cls._create_share_type()
         cls.share_type_id = cls.share_type['id']
@@ -320,13 +329,17 @@
     protocol = "glusterfs"
 
     @classmethod
-    def resource_setup(cls):
-        super(ShareCertRulesForGLUSTERFSTest, cls).resource_setup()
+    def skip_checks(cls):
+        super(ShareCertRulesForGLUSTERFSTest, cls).skip_checks()
         if (cls.protocol not in CONF.share.enable_protocols or
                 cls.protocol not in
                 CONF.share.enable_cert_rules_for_protocols):
             msg = "Cert rule tests for %s protocol are disabled" % cls.protocol
             raise cls.skipException(msg)
+
+    @classmethod
+    def resource_setup(cls):
+        super(ShareCertRulesForGLUSTERFSTest, cls).resource_setup()
         # create share type
         cls.share_type = cls._create_share_type()
         cls.share_type_id = cls.share_type['id']
@@ -436,14 +449,18 @@
     protocol = "cephfs"
 
     @classmethod
-    def resource_setup(cls):
-        super(ShareCephxRulesForCephFSTest, cls).resource_setup()
+    def skip_checks(cls):
+        super(ShareCephxRulesForCephFSTest, cls).skip_checks()
         if (cls.protocol not in CONF.share.enable_protocols or
                 cls.protocol not in
                 CONF.share.enable_cephx_rules_for_protocols):
             msg = ("Cephx rule tests for %s protocol are disabled." %
                    cls.protocol)
             raise cls.skipException(msg)
+
+    @classmethod
+    def resource_setup(cls):
+        super(ShareCephxRulesForCephFSTest, cls).resource_setup()
         # create share type
         cls.share_type = cls._create_share_type()
         cls.share_type_id = cls.share_type['id']
@@ -483,8 +500,8 @@
 class ShareRulesTest(base.BaseSharesMixedTest):
 
     @classmethod
-    def resource_setup(cls):
-        super(ShareRulesTest, cls).resource_setup()
+    def skip_checks(cls):
+        super(ShareRulesTest, cls).skip_checks()
         if not (any(p in CONF.share.enable_ip_rules_for_protocols
                     for p in cls.protocols) or
                 any(p in CONF.share.enable_user_rules_for_protocols
@@ -495,6 +512,10 @@
                     for p in cls.protocols)):
             cls.message = "Rule tests are disabled"
             raise cls.skipException(cls.message)
+
+    @classmethod
+    def resource_setup(cls):
+        super(ShareRulesTest, cls).resource_setup()
         if CONF.share.enable_ip_rules_for_protocols:
             cls.protocol = CONF.share.enable_ip_rules_for_protocols[0]
             cls.access_type = "ip"
diff --git a/manila_tempest_tests/tests/scenario/manager.py b/manila_tempest_tests/tests/scenario/manager.py
index e767b02..6e8a2f6 100644
--- a/manila_tempest_tests/tests/scenario/manager.py
+++ b/manila_tempest_tests/tests/scenario/manager.py
@@ -330,31 +330,19 @@
         return image['id']
 
     def glance_image_create(self):
-        img_path = CONF.scenario.img_dir + "/" + CONF.scenario.img_file
-        aki_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.aki_img_file
-        ari_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ari_img_file
-        ami_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ami_img_file
+        img_path = CONF.scenario.img_file
         img_container_format = CONF.scenario.img_container_format
         img_disk_format = CONF.scenario.img_disk_format
         img_properties = CONF.scenario.img_properties
         LOG.debug("paths: img: %s, container_format: %s, disk_format: %s, "
-                  "properties: %s, ami: %s, ari: %s, aki: %s",
+                  "properties: %s",
                   img_path, img_container_format, img_disk_format,
-                  img_properties, ami_img_path, ari_img_path, aki_img_path)
-        try:
-            image = self._image_create('scenario-img',
-                                       img_container_format,
-                                       img_path,
-                                       disk_format=img_disk_format,
-                                       properties=img_properties)
-        except IOError:
-            LOG.debug("A qcow2 image was not found. Try to get a uec image.")
-            kernel = self._image_create('scenario-aki', 'aki', aki_img_path)
-            ramdisk = self._image_create('scenario-ari', 'ari', ari_img_path)
-            properties = {'kernel_id': kernel, 'ramdisk_id': ramdisk}
-            image = self._image_create('scenario-ami', 'ami',
-                                       path=ami_img_path,
-                                       properties=properties)
+                  img_properties)
+        image = self._image_create('scenario-img',
+                                   img_container_format,
+                                   img_path,
+                                   disk_format=img_disk_format,
+                                   properties=img_properties)
         LOG.debug("image:%s", image)
 
         return image
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index c4cf027..1ae1b4a 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -61,18 +61,14 @@
         super(ShareScenarioTest, cls).skip_checks()
         if not CONF.service_available.manila:
             raise cls.skipException("Manila support is required")
+        if cls.ip_version == 6 and not CONF.share.run_ipv6_tests:
+            raise cls.skipException("IPv6 tests are disabled")
+        if cls.protocol not in CONF.share.enable_protocols:
+            message = "%s tests are disabled" % cls.protocol
+            raise cls.skipException(message)
 
     def setUp(self):
         base.verify_test_has_appropriate_tags(self)
-        if self.ipv6_enabled and not CONF.share.run_ipv6_tests:
-            raise self.skipException("IPv6 tests are disabled")
-        if self.protocol not in CONF.share.enable_protocols:
-            message = "%s tests are disabled" % self.protocol
-            raise self.skipException(message)
-        if self.protocol not in CONF.share.enable_ip_rules_for_protocols:
-            message = ("%s tests for access rules other than IP are disabled" %
-                       self.protocol)
-            raise self.skipException(message)
         super(ShareScenarioTest, self).setUp()
 
         self.image_id = None
@@ -381,6 +377,13 @@
             locations = [x['path'] for x in exports]
         return locations
 
+    def _get_snapshot_export_locations(self, snapshot):
+        exports = (self.shares_v2_client.
+                   list_snapshot_export_locations(snapshot['id']))
+        locations = [x['path'] for x in exports]
+
+        return locations
+
     def _get_ipv6_server_ip(self, instance):
         ipv6_addrs = []
         for network_name, nic_list in instance['addresses'].items():
@@ -583,3 +586,51 @@
 
         LOG.info('Creating Glance image using the downloaded image file')
         return self._image_create('centos', 'bare', imagepath, 'qcow2')
+
+    def get_share_export_location_for_mount(self, share):
+        exports = self.get_user_export_locations(
+            share=share,
+            error_on_invalid_ip_version=True)
+        return exports[0]
+
+    def get_user_export_locations(self, share=None, snapshot=None,
+                                  error_on_invalid_ip_version=False):
+        locations = None
+        if share:
+            locations = self.get_share_export_locations(share)
+        elif snapshot:
+            locations = self._get_snapshot_export_locations(snapshot)
+
+        self.assertNotEmpty(locations)
+        locations = self._get_export_locations_according_to_ip_version(
+            locations, error_on_invalid_ip_version)
+        self.assertNotEmpty(locations)
+
+        return locations
+
+    def _get_export_locations_according_to_ip_version(
+            self, all_locations, error_on_invalid_ip_version):
+        locations = [
+            x for x in all_locations
+            if self.get_ip_and_version_from_export_location(
+                x)[1] == self.ip_version]
+
+        if len(locations) == 0 and not error_on_invalid_ip_version:
+            message = ("Configured backend does not support "
+                       "ip_version %s" % self.ip_version)
+            raise self.skipException(message)
+        return locations
+
+    def get_ip_and_version_from_export_location(self, export):
+        export = export.replace('[', '').replace(']', '')
+        if self.protocol == 'nfs' and ':/' in export:
+            ip = export.split(':/')[0]
+            version = 6 if ip.count(':') > 1 else 4
+        elif self.protocol == 'cifs' and export.startswith(r'\\'):
+            ip = export.split('\\')[2]
+            version = 6 if (ip.count(':') > 1 or
+                            ip.endswith('ipv6-literal.net')) else 4
+        else:
+            message = ("Protocol %s is not supported" % self.protocol)
+            raise self.skipException(message)
+        return ip, version
diff --git a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
index 3ead5df..8a55b2e 100644
--- a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
+++ b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
@@ -44,19 +44,13 @@
      * Terminate the instance
     """
 
-    def get_ip_and_version_from_export_location(self, export):
-        export = export.replace('[', '').replace(']', '')
-        if self.protocol == 'nfs' and ':/' in export:
-            ip = export.split(':/')[0]
-            version = 6 if ip.count(':') > 1 else 4
-        elif self.protocol == 'cifs' and export.startswith(r'\\'):
-            ip = export.split('\\')[2]
-            version = 6 if (ip.count(':') > 1 or
-                            ip.endswith('ipv6-literal.net')) else 4
-        else:
-            message = ("Protocol %s is not supported" % self.protocol)
-            raise self.skipException(message)
-        return ip, version
+    @classmethod
+    def skip_checks(cls):
+        super(ShareBasicOpsBase, cls).skip_checks()
+        if cls.protocol not in CONF.share.enable_ip_rules_for_protocols:
+            message = ("%s tests for access rules other than IP are disabled" %
+                       cls.protocol)
+            raise cls.skipException(message)
 
     def _ping_host_from_export_location(self, export, remote_client):
         ip, version = self.get_ip_and_version_from_export_location(export)
@@ -65,46 +59,11 @@
         else:
             remote_client.exec_command("ping -c 5 %s" % ip)
 
-    def _get_export_locations_according_to_ip_version(
-            self, all_locations, error_on_invalid_ip_version):
-        locations = [
-            x for x in all_locations
-            if self.get_ip_and_version_from_export_location(
-                x)[1] == self.ip_version]
-
-        if len(locations) == 0 and not error_on_invalid_ip_version:
-            message = ("Configured backend does not support "
-                       "ip_version %s" % self.ip_version)
-            raise self.skipException(message)
-        return locations
-
-    def _get_user_export_locations(self, share=None, snapshot=None,
-                                   error_on_invalid_ip_version=False):
-        locations = None
-        if share:
-            locations = self.get_share_export_locations(share)
-        elif snapshot:
-            locations = self._get_snapshot_export_locations(snapshot)
-
-        self.assertNotEmpty(locations)
-        locations = self._get_export_locations_according_to_ip_version(
-            locations, error_on_invalid_ip_version)
-        self.assertNotEmpty(locations)
-
-        return locations
-
-    def _get_snapshot_export_locations(self, snapshot):
-        exports = (self.shares_v2_client.
-                   list_snapshot_export_locations(snapshot['id']))
-        locations = [x['path'] for x in exports]
-
-        return locations
-
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
     def test_mount_share_one_vm(self):
         instance = self.boot_instance(wait_until="BUILD")
         self.create_share()
-        locations = self._get_user_export_locations(self.share)
+        locations = self.get_user_export_locations(self.share)
         instance = self.wait_for_active_instance(instance["id"])
         remote_client = self.init_remote_client(instance)
         self.provide_access_to_auxiliary_instance(instance)
@@ -116,16 +75,11 @@
     @tc.attr(base.TAG_NEGATIVE, base.TAG_BACKEND)
     def test_write_with_ro_access(self):
         '''Test if an instance with ro access can write on the share.'''
-        if self.protocol.upper() == 'CIFS':
-            msg = ("Skipped for CIFS protocol because RO access is not "
-                   "supported for shares by IP.")
-            raise self.skipException(msg)
-
         test_data = "Some test data to write"
 
         instance = self.boot_instance(wait_until="BUILD")
         self.create_share()
-        location = self._get_user_export_locations(self.share)[0]
+        location = self.get_user_export_locations(self.share)[0]
         instance = self.wait_for_active_instance(instance["id"])
 
         remote_client_inst = self.init_remote_client(instance)
@@ -153,7 +107,7 @@
         instance1 = self.boot_instance(wait_until="BUILD")
         instance2 = self.boot_instance(wait_until="BUILD")
         self.create_share()
-        location = self._get_user_export_locations(self.share)[0]
+        location = self.get_user_export_locations(self.share)[0]
         instance1 = self.wait_for_active_instance(instance1["id"])
         instance2 = self.wait_for_active_instance(instance2["id"])
 
@@ -210,7 +164,7 @@
 
         instance = self.boot_instance(wait_until="BUILD")
         self.create_share()
-        exports = self._get_user_export_locations(self.share)
+        exports = self.get_user_export_locations(self.share)
         instance = self.wait_for_active_instance(instance["id"])
         self.share = self.shares_admin_v2_client.get_share(self.share['id'])
 
@@ -266,7 +220,7 @@
 
         self.share = self.migration_complete(self.share['id'], dest_pool)
 
-        new_exports = self._get_user_export_locations(
+        new_exports = self.get_user_export_locations(
             self.share, error_on_invalid_ip_version=True)
 
         self.assertEqual(dest_pool, self.share['host'])
@@ -289,10 +243,6 @@
     @testtools.skipUnless(
         CONF.share.run_snapshot_tests, "Snapshot tests are disabled.")
     def test_write_data_to_share_created_from_snapshot(self):
-        if self.protocol.upper() == 'CIFS':
-            msg = "Skipped for CIFS protocol because of bug/1649573"
-            raise self.skipException(msg)
-
         # 1 - Create UVM, ok, created
         instance = self.boot_instance(wait_until="BUILD")
 
@@ -308,7 +258,7 @@
         self.provide_access_to_auxiliary_instance(instance, parent_share)
 
         # 5 - Try mount S1 to UVM, ok, mounted
-        user_export_location = self._get_user_export_locations(parent_share)[0]
+        user_export_location = self.get_user_export_locations(parent_share)[0]
         parent_share_dir = "/mnt/parent"
         remote_client.exec_command("sudo mkdir -p %s" % parent_share_dir)
 
@@ -330,7 +280,7 @@
 
         # 10 - Try mount S2 - fail, access denied. We test that child share
         #      did not get access rules from parent share.
-        user_export_location = self._get_user_export_locations(child_share)[0]
+        user_export_location = self.get_user_export_locations(child_share)[0]
         child_share_dir = "/mnt/child"
         remote_client.exec_command("sudo mkdir -p %s" % child_share_dir)
 
@@ -377,10 +327,6 @@
     @testtools.skipUnless(CONF.share.run_snapshot_tests,
                           "Snapshot tests are disabled.")
     def test_read_mountable_snapshot(self):
-        if self.protocol.upper() == 'CIFS':
-            msg = "Skipped for CIFS protocol because of bug/1649573"
-            raise self.skipException(msg)
-
         # 1 - Create UVM, ok, created
         instance = self.boot_instance(wait_until="BUILD")
 
@@ -396,7 +342,7 @@
         self.provide_access_to_auxiliary_instance(instance, parent_share)
 
         # 5 - Try mount S1 to UVM, ok, mounted
-        user_export_location = self._get_user_export_locations(parent_share)[0]
+        user_export_location = self.get_user_export_locations(parent_share)[0]
         parent_share_dir = "/mnt/parent"
         snapshot_dir = "/mnt/snapshot_dir"
         remote_client.exec_command("sudo mkdir -p %s" % parent_share_dir)
@@ -419,7 +365,7 @@
         self.provide_access_to_auxiliary_instance(instance, snapshot=snapshot)
 
         # 10 - Mount SS1
-        user_export_location = self._get_user_export_locations(
+        user_export_location = self.get_user_export_locations(
             snapshot=snapshot)[0]
         self.mount_share(user_export_location, remote_client, snapshot_dir)
         self.addCleanup(self.unmount_share, remote_client, snapshot_dir)
@@ -463,6 +409,22 @@
             "sudo mount.cifs \"%s\" %s -o guest" % (location, target_dir)
         )
 
+    @tc.attr(base.TAG_NEGATIVE, base.TAG_BACKEND)
+    def test_write_with_ro_access(self):
+        msg = ("Skipped for CIFS protocol because RO access is not "
+               "supported for shares by IP.")
+        raise self.skipException(msg)
+
+    @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
+    def test_read_mountable_snapshot(self):
+        msg = "Skipped for CIFS protocol because of bug/1649573"
+        raise self.skipException(msg)
+
+    @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
+    def test_write_data_to_share_created_from_snapshot(self):
+        msg = "Skipped for CIFS protocol because of bug/1649573"
+        raise self.skipException(msg)
+
 
 class TestShareBasicOpsNFSIPv6(TestShareBasicOpsNFS):
     ip_version = 6
diff --git a/manila_tempest_tests/tests/scenario/test_share_extend.py b/manila_tempest_tests/tests/scenario/test_share_extend.py
index 446ec25..7827b75 100644
--- a/manila_tempest_tests/tests/scenario/test_share_extend.py
+++ b/manila_tempest_tests/tests/scenario/test_share_extend.py
@@ -45,6 +45,14 @@
      * Terminate the instance
     """
 
+    @classmethod
+    def skip_checks(cls):
+        super(ShareExtendBase, cls).skip_checks()
+        if cls.protocol not in CONF.share.enable_ip_rules_for_protocols:
+            message = ("%s tests for access rules other than IP are disabled" %
+                       cls.protocol)
+            raise cls.skipException(message)
+
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
     def test_create_extend_and_write(self):
         default_share_size = CONF.share.share_size
@@ -63,10 +71,9 @@
         LOG.debug('Step 4 - grant access')
         self.provide_access_to_auxiliary_instance(instance, share=share)
 
-        locations = self.get_share_export_locations(share)
-
         LOG.debug('Step 5 - mount')
-        self.mount_share(locations[0], remote_client)
+        location = self.get_share_export_location_for_mount(share)
+        self.mount_share(location, remote_client)
 
         total_blocks = (units.Ki * default_share_size) / 64
         three_quarter_blocks = (total_blocks / 4) * 3
@@ -99,7 +106,7 @@
         self.assertEqual(extended_share_size, int(share["size"]))
 
         LOG.debug('Step 8 - writing more data, should succeed')
-        self.write_data_with_remount(locations[0], remote_client, '/mnt/t3',
+        self.write_data_with_remount(location, remote_client, '/mnt/t3',
                                      '64M', over_one_quarter_blocks)
         ls_result = remote_client.exec_command("sudo ls -lAh /mnt/")
         LOG.debug(ls_result)
diff --git a/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py b/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
index 8e93335..d58378c 100644
--- a/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
+++ b/manila_tempest_tests/tests/scenario/test_share_manage_unmanage.py
@@ -51,6 +51,14 @@
      * Terminate the instance
     """
 
+    @classmethod
+    def skip_checks(cls):
+        super(ShareManageUnmanageBase, cls).skip_checks()
+        if cls.protocol not in CONF.share.enable_ip_rules_for_protocols:
+            message = ("%s tests for access rules other than IP are disabled" %
+                       cls.protocol)
+            raise cls.skipException(message)
+
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
     @testtools.skipUnless(
         CONF.share.run_manage_unmanage_tests,
diff --git a/manila_tempest_tests/tests/scenario/test_share_shrink.py b/manila_tempest_tests/tests/scenario/test_share_shrink.py
index 44882c8..0036296 100644
--- a/manila_tempest_tests/tests/scenario/test_share_shrink.py
+++ b/manila_tempest_tests/tests/scenario/test_share_shrink.py
@@ -46,6 +46,14 @@
      * Terminate the instance
     """
 
+    @classmethod
+    def skip_checks(cls):
+        super(ShareShrinkBase, cls).skip_checks()
+        if cls.protocol not in CONF.share.enable_ip_rules_for_protocols:
+            message = ("%s tests for access rules other than IP are disabled" %
+                       cls.protocol)
+            raise cls.skipException(message)
+
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
     @testtools.skipUnless(
         CONF.share.run_shrink_tests, 'Shrink share tests are disabled.')
@@ -66,10 +74,9 @@
         LOG.debug('Step 4 - grant access')
         self.provide_access_to_auxiliary_instance(instance)
 
-        locations = self.get_share_export_locations(share)
-
         LOG.debug('Step 5 - mount')
-        self.mount_share(locations[0], remote_client)
+        location = self.get_share_export_location_for_mount(share)
+        self.mount_share(location, remote_client)
 
         total_blocks = (1024 * default_share_size) / 64
         blocks = total_blocks + 4
diff --git a/releasenotes/notes/bug-1848278-a37290750e6ac248.yaml b/releasenotes/notes/bug-1848278-a37290750e6ac248.yaml
new file mode 100644
index 0000000..f0ce109
--- /dev/null
+++ b/releasenotes/notes/bug-1848278-a37290750e6ac248.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    Instead of using the first export location, use the first export location
+    matching the address family (IPv4 or IPv6) matching that to be used for the
+    mount.
diff --git a/setup.cfg b/setup.cfg
index 1bbfef0..9da84c3 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -14,36 +14,14 @@
     Operating System :: POSIX :: Linux
     Programming Language :: Python
     Programming Language :: Python :: 3
-    Programming Language :: Python :: 3.3
     Programming Language :: Python :: 3.5
+    Programming Language :: Python :: 3.6
+    Programming Language :: Python :: 3.7
 
 [files]
 packages =
     manila_tempest_tests
 
-[build_sphinx]
-all-files = 1
-warning-is-error = 1
-source-dir = doc/source
-build-dir = doc/build
-
-[upload_sphinx]
-upload-dir = doc/build/html
-
-[compile_catalog]
-directory = manila_tempest_tests/locale
-domain = manila_tempest_tests
-
-[update_catalog]
-domain = manila_tempest_tests
-output_dir = manila_tempest_tests/locale
-input_file = manila_tempest_tests/locale/manila-tempest-plugin.pot
-
-[extract_messages]
-keywords = _ gettext ngettext l_ lazy_gettext
-mapping_file = babel.cfg
-output_file = manila_tempest_tests/locale/manila-tempest-plugin.pot
-
 [entry_points]
 tempest.test_plugins =
     manila_tests = manila_tempest_tests.plugin:ManilaTempestPlugin
diff --git a/test-requirements.txt b/test-requirements.txt
index 6a6ab89..e3eead6 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -10,6 +10,6 @@
 oslotest>=3.2.0 # Apache-2.0
 stestr>=1.0.0 # Apache-2.0
 testtools>=2.2.0 # MIT
-openstackdocstheme>=1.18.1 # Apache-2.0
+openstackdocstheme>=1.31.2 # Apache-2.0
 # releasenotes
 reno>=2.5.0 # Apache-2.0
diff --git a/tox.ini b/tox.ini
index 59764db..a185fab 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,15 +6,17 @@
 [testenv]
 basepython = python3
 usedevelop = True
-install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
 setenv =
    VIRTUAL_ENV={envdir}
    PYTHONWARNINGS=default::DeprecationWarning
    OS_STDOUT_CAPTURE=1
    OS_STDERR_CAPTURE=1
    OS_TEST_TIMEOUT=60
-deps = -r{toxinidir}/requirements.txt
-       -r{toxinidir}/test-requirements.txt
+deps =
+  -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
+  -r{toxinidir}/requirements.txt
+  -r{toxinidir}/test-requirements.txt
+
 # commands = python setup.py test --slowest --testr-args='{posargs}'
 
 [testenv:pep8]
@@ -24,7 +26,7 @@
 commands = {posargs}
 
 [testenv:docs]
-commands = python setup.py build_sphinx
+commands = sphinx-build -W -b html doc/source doc/build/html
 
 [testenv:releasenotes]
 commands =