<s> import functools <EOL> from nailgun import consts <EOL> from nailgun . test . base import EnvironmentManager <EOL> from nailgun . test . performance import base <EOL> class NodeGroupOperationsLoadTest ( base . BaseUnitLoadTestCase ) : <EOL> class NameGenerator ( object ) : <EOL> def __init__ ( self , base_name ) : <EOL> self . base_name = base_name <EOL> self . counter = <NUM_LIT:0> <EOL> @ property <EOL> def next_name ( self ) : <EOL> self . counter += <NUM_LIT:1> <EOL> return '<STR_LIT>' . format ( self . base_name , self . counter ) <EOL> @ property <EOL> def name ( self ) : <EOL> return '<STR_LIT>' . format ( self . base_name , self . counter ) <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> super ( NodeGroupOperationsLoadTest , cls ) . setUpClass ( ) <EOL> cls . env = EnvironmentManager ( app = cls . app , session = cls . db ) <EOL> cls . env . upload_fixtures ( cls . fixtures ) <EOL> cls . cluster = cls . env . create_cluster ( <EOL> api = False , <EOL> net_provider = consts . CLUSTER_NET_PROVIDERS . neutron , <EOL> net_segment_type = consts . NEUTRON_SEGMENT_TYPES . gre , <EOL> ) <EOL> cls . group = cls . env . create_node_group ( ) <EOL> cls . name_gen = cls . NameGenerator ( '<STR_LIT>' ) <EOL> cls . env . create_nodes ( cls . NODES_NUM , cluster_id = cls . cluster [ '<STR_LIT:id>' ] ) <EOL> @ base . evaluate_unit_performance <EOL> def test_node_group_collection_retrieve ( self ) : <EOL> func = functools . partial ( <EOL> self . get_handler , <EOL> '<STR_LIT>' , <EOL> ) <EOL> self . check_time_exec ( func ) <EOL> @ base . evaluate_unit_performance <EOL> def test_node_group_collection_creation ( self ) : <EOL> func = functools . partial ( <EOL> self . post_handler , <EOL> '<STR_LIT>' , <EOL> { <EOL> '<STR_LIT>' : self . cluster . id , <EOL> '<STR_LIT:name>' : self . name_gen . next_name <EOL> } <EOL> ) <EOL> self . check_time_exec ( func ) </s>
