def test_populate_servers_cache_with_project_name_none(servers_detail, aggregator): """ Ensure the cache contains the expected VMs between check runs. """ check = OpenStackControllerCheck("test", {'ssl_verify': False}, [copy.deepcopy(common.KEYSTONE_INSTANCE)]) # Start off with a list of servers check.servers_cache = copy.deepcopy(common.SERVERS_CACHE_MOCK) # Update the cached list of servers based on what the endpoint returns check.populate_servers_cache( { '': { "id": '6f70656e737461636b20342065766572', "name": None }, 'blacklist_1': { "id": 'blacklist_1', "name": 'blacklist_1' }, 'blacklist_2': { "id": 'blacklist_2', "name": 'blacklist_2' }, }, [], ) servers = check.servers_cache['servers'] assert 'server_newly_added' not in servers assert 'server-1' not in servers assert 'other-1' in servers assert 'other-2' in servers
def test_get_paginated_server(servers_detail, aggregator): """ Ensure the server cache is updated while using pagination """ check = OpenStackControllerCheck( "test", { 'keystone_server_url': 'http://10.0.2.15:5000', 'ssl_verify': False, 'exclude_server_ids': common.EXCLUDED_SERVER_IDS, 'paginated_server_limit': 1, }, {}, instances=instances, ) check.populate_servers_cache( { 'testproj': { "id": "6f70656e737461636b20342065766572", "name": "testproj" } }, []) servers = check.servers_cache['servers'] assert 'server-1' in servers assert 'other-1' not in servers assert 'other-2' not in servers
def test_get_paginated_server(servers_detail, aggregator): """ Ensure the server cache is updated while using pagination """ check = OpenStackControllerCheck( "test", {'ssl_verify': False, 'paginated_server_limit': 1}, {}, instances=[common.KEYSTONE_INSTACE] ) check.populate_servers_cache({'testproj': {"id": "6f70656e737461636b20342065766572", "name": "testproj"}}, []) servers = check.servers_cache['servers'] assert 'server-1' in servers assert 'other-1' not in servers assert 'other-2' not in servers
def test_populate_servers_cache_with_project_name_none(servers_detail, aggregator): """ Ensure the cache contains the expected VMs between check runs. """ check = OpenStackControllerCheck( "test", { 'keystone_server_url': 'http://10.0.2.15:5000', 'ssl_verify': False, 'exclude_server_ids': common.EXCLUDED_SERVER_IDS, }, {}, instances=instances, ) # Start off with a list of servers check.servers_cache = copy.deepcopy(common.SERVERS_CACHE_MOCK) # Update the cached list of servers based on what the endpoint returns check.populate_servers_cache( { '': { "id": '6f70656e737461636b20342065766572', "name": None }, 'blacklist_1': { "id": 'blacklist_1', "name": 'blacklist_1' }, 'blacklist_2': { "id": 'blacklist_2', "name": 'blacklist_2' }, }, [], ) servers = check.servers_cache['servers'] assert 'server_newly_added' not in servers assert 'server-1' not in servers assert 'other-1' in servers assert 'other-2' in servers