Coverage for manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_driver_interfaces.py: 100%
17 statements
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
1# Copyright (c) 2015 Clinton Knight. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14"""
15Mock unit tests for the NetApp file share driver interfaces
16"""
18from unittest import mock
20from manila.share.drivers.netapp.dataontap.cluster_mode import drv_multi_svm
21from manila.share.drivers.netapp.dataontap.cluster_mode import drv_single_svm
22from manila import test
25class NetAppFileStorageDriverInterfaceTestCase(test.TestCase):
27 def setUp(self):
28 super(NetAppFileStorageDriverInterfaceTestCase, self).setUp()
30 self.mock_object(drv_multi_svm.NetAppCmodeMultiSvmShareDriver,
31 '__init__',
32 mock.Mock(return_value=None))
33 self.mock_object(drv_single_svm.NetAppCmodeSingleSvmShareDriver,
34 '__init__',
35 mock.Mock(return_value=None))
37 self.drv_multi_svm = drv_multi_svm.NetAppCmodeMultiSvmShareDriver()
38 self.drv_single_svm = drv_single_svm.NetAppCmodeSingleSvmShareDriver()
40 def test_driver_interfaces_match(self):
41 """Ensure the NetApp file storage driver interfaces match.
43 The two file share Manila drivers from NetApp (cDOT multi-SVM,
44 cDOT single-SVM) are merely passthrough shim layers atop a common
45 file storage library. Bugs are easily introduced when a Manila
46 method is exposed via a subset of those driver shims. This test
47 ensures they remain in sync and the library features are uniformly
48 available in the drivers.
49 """
51 # Get local functions of each driver interface
52 multi_svm_methods = self._get_local_functions(self.drv_multi_svm)
53 single_svm_methods = self._get_local_functions(self.drv_single_svm)
55 # Ensure NetApp file share driver shims are identical
56 self.assertSetEqual(multi_svm_methods, single_svm_methods)
58 def _get_local_functions(self, obj):
59 """Get function names of an object without superclass functions."""
60 return set([key for key, value in type(obj).__dict__.items()
61 if callable(value)])