Coverage for manila/tests/test_test.py: 72%

16 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2026-02-18 22:39 +0000

1# Copyright 2010 United States Government as represented by the 

2# Administrator of the National Aeronautics and Space Administration. 

3# All Rights Reserved. 

4# 

5# Licensed under the Apache License, Version 2.0 (the "License"); you may 

6# not use this file except in compliance with the License. You may obtain 

7# a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, software 

12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

14# License for the specific language governing permissions and limitations 

15# under the License. 

16 

17"""Tests for the testing base code.""" 

18 

19from oslo_config import cfg 

20import oslo_messaging as messaging 

21 

22from manila import rpc 

23from manila import test 

24 

25 

26class IsolationTestCase(test.TestCase): 

27 """Ensure that things are cleaned up after failed tests. 

28 

29 These tests don't really do much here, but if isolation fails a bunch 

30 of other tests should fail. 

31 

32 """ 

33 def test_service_isolation(self): 

34 self.start_service('share') 

35 

36 def test_rpc_consumer_isolation(self): 

37 class NeverCalled(object): 

38 

39 def __getattribute__(self, name): 

40 if name == 'target' or name == 'oslo_rpc_server_ping': 

41 # oslo.messaging >=5.31.0 explicitly looks for 'target' 

42 # on the endpoint and checks its type, so we can't avoid 

43 # it here. In 12.4.0, the package added a ping endpoint 

44 # Just ignore if either case. 

45 return 

46 assert False, "I should never get called - name: %s" % name 

47 

48 target = messaging.Target(topic='share', server=cfg.CONF.host) 

49 server = rpc.get_server(target=target, endpoints=[NeverCalled()]) 

50 server.start()