1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2012 OpenStack LLC.
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7
# not use this file except in compliance with the License. You may obtain
8
# a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
# License for the specific language governing permissions and limitations
20
from nova import local
25
"""Make weak referencable object."""
29
class LocalStoreTestCase(test.TestCase):
34
def test_thread_unique_storage(self):
35
"""Make sure local store holds thread specific values."""
37
local.store.a = self.v1
40
local.store.a = self.v2
41
expected_set.append(getattr(local.store, 'a'))
44
local.store.a = self.v3
45
expected_set.append(getattr(local.store, 'a'))
47
eventlet.spawn(do_something).wait()
48
eventlet.spawn(do_something2).wait()
49
expected_set.append(getattr(local.store, 'a'))
51
self.assertTrue(self.v1 in expected_set)
52
self.assertTrue(self.v2 in expected_set)
53
self.assertTrue(self.v3 in expected_set)