@@ -3020,31 +3020,6 @@ def test__refresh_hash_ring_peer_list(self, mock_can_send):
3020
3020
uncalled = ['host3' ])
3021
3021
mock_can_send .assert_called_once_with (min_version = '1.46' )
3022
3022
3023
- @mock .patch .object (ironic_driver .IronicDriver , '_can_send_version' )
3024
- def test__refresh_hash_ring_peer_list_shard (self , mock_can_send ):
3025
- services = ['host1' , 'host2' , 'host3' ]
3026
- expected_hosts = {'host1' }
3027
- self .mock_is_up .return_value = True
3028
- self .flags (host = 'host1' )
3029
- self .flags (shard = 'shard1' , group = 'ironic' )
3030
- self ._test__refresh_hash_ring (services , expected_hosts ,
3031
- uncalled = ['host2' , 'host3' ])
3032
- mock_can_send .assert_not_called ()
3033
-
3034
- @mock .patch .object (ironic_driver .IronicDriver , '_can_send_version' )
3035
- def test__refresh_hash_ring_peer_list_shard_and_cg (self , mock_can_send ):
3036
- services = ['host1' , 'host2' , 'host3' ]
3037
- expected_hosts = {'host1' }
3038
- self .mock_is_up .return_value = True
3039
- self .flags (host = 'host1' )
3040
- self .flags (shard = 'shard1' , group = 'ironic' )
3041
- self .flags (conductor_group = 'not-none' , group = 'ironic' )
3042
- # Note that this is getting ignored, because the shard is set
3043
- self .flags (peer_list = ['host1' , 'host2' ], group = 'ironic' )
3044
- self ._test__refresh_hash_ring (services , expected_hosts ,
3045
- uncalled = ['host2' , 'host3' ])
3046
- mock_can_send .assert_not_called ()
3047
-
3048
3023
@mock .patch .object (ironic_driver .IronicDriver , '_can_send_version' )
3049
3024
def test__refresh_hash_ring_peer_list_old_api (self , mock_can_send ):
3050
3025
mock_can_send .side_effect = (
@@ -3119,8 +3094,7 @@ def setUp(self, mock_services):
3119
3094
def _test__refresh_cache (self , instances , nodes , hosts , mock_instances ,
3120
3095
mock_nodes , mock_hosts , mock_hash_ring ,
3121
3096
mock_can_send , partition_key = None ,
3122
- can_send_146 = True , shard = None ,
3123
- can_send_182 = True ):
3097
+ can_send_146 = True ):
3124
3098
mock_instances .return_value = instances
3125
3099
mock_nodes .return_value = nodes
3126
3100
mock_hosts .side_effect = hosts
@@ -3130,18 +3104,12 @@ def _test__refresh_cache(self, instances, nodes, hosts, mock_instances,
3130
3104
if not can_send_146 :
3131
3105
mock_can_send .side_effect = (
3132
3106
exception .IronicAPIVersionNotAvailable (version = '1.46' ))
3133
- if not can_send_182 :
3134
- mock_can_send .side_effect = None , (
3135
- exception .IronicAPIVersionNotAvailable (version = '1.82' ))
3136
-
3137
3107
self .driver .node_cache = {}
3138
3108
self .driver .node_cache_time = None
3139
3109
3140
3110
kwargs = {}
3141
3111
if partition_key is not None and can_send_146 :
3142
3112
kwargs ['conductor_group' ] = partition_key
3143
- if shard and can_send_182 :
3144
- kwargs ["shard" ] = shard
3145
3113
3146
3114
self .driver ._refresh_cache ()
3147
3115
@@ -3219,74 +3187,6 @@ def test__refresh_cache_partition_key(self):
3219
3187
expected_cache = {n .uuid : n for n in nodes }
3220
3188
self .assertEqual (expected_cache , self .driver .node_cache )
3221
3189
3222
- def test__refresh_cache_shard (self ):
3223
- # normal operation, one compute service
3224
- instances = []
3225
- nodes = [
3226
- _get_cached_node (
3227
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3228
- _get_cached_node (
3229
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3230
- _get_cached_node (
3231
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3232
- ]
3233
- hosts = [self .host , self .host , self .host ]
3234
- shard = "shard1"
3235
- self .flags (shard = shard , group = 'ironic' )
3236
-
3237
- self ._test__refresh_cache (instances , nodes , hosts ,
3238
- shard = shard )
3239
-
3240
- expected_cache = {n .uuid : n for n in nodes }
3241
- self .assertEqual (expected_cache , self .driver .node_cache )
3242
-
3243
- def test__refresh_cache_shard_and_conductor_group (self ):
3244
- # normal operation, one compute service
3245
- instances = []
3246
- nodes = [
3247
- _get_cached_node (
3248
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3249
- _get_cached_node (
3250
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3251
- _get_cached_node (
3252
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3253
- ]
3254
- hosts = [self .host , self .host , self .host ]
3255
- shard = "shard1"
3256
- self .flags (shard = shard , group = 'ironic' )
3257
- partition_key = 'some-group'
3258
- self .flags (conductor_group = partition_key , group = 'ironic' )
3259
-
3260
- self ._test__refresh_cache (instances , nodes , hosts ,
3261
- shard = shard , partition_key = partition_key )
3262
-
3263
- expected_cache = {n .uuid : n for n in nodes }
3264
- self .assertEqual (expected_cache , self .driver .node_cache )
3265
-
3266
- def test__refresh_cache_shard_and_conductor_group_skip_shard (self ):
3267
- # normal operation, one compute service
3268
- instances = []
3269
- nodes = [
3270
- _get_cached_node (
3271
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3272
- _get_cached_node (
3273
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3274
- _get_cached_node (
3275
- uuid = uuidutils .generate_uuid (), instance_uuid = None ),
3276
- ]
3277
- hosts = [self .host , self .host , self .host ]
3278
- shard = "shard1"
3279
- self .flags (shard = shard , group = 'ironic' )
3280
- partition_key = 'some-group'
3281
- self .flags (conductor_group = partition_key , group = 'ironic' )
3282
-
3283
- self ._test__refresh_cache (instances , nodes , hosts ,
3284
- shard = shard , partition_key = partition_key ,
3285
- can_send_182 = False )
3286
-
3287
- expected_cache = {n .uuid : n for n in nodes }
3288
- self .assertEqual (expected_cache , self .driver .node_cache )
3289
-
3290
3190
def test__refresh_cache_partition_key_old_api (self ):
3291
3191
# normal operation, one compute service
3292
3192
instances = []
0 commit comments