<s> """<STR_LIT>""" <EOL> from test_repo . database . fixtures import DBaaSFixture <EOL> class TestCreateInstances ( DBaaSFixture ) : <EOL> instance_id = None <EOL> tiny_instance_id = None <EOL> sml_instance_id = None <EOL> med_instance_id = None <EOL> lrg_instance_id = None <EOL> xlrg_instance_id = None <EOL> xxlrg_instance_id = None <EOL> multi_dbs_instance_id = None <EOL> req_params_instance_id = None <EOL> multi_users_instance_id = None <EOL> all_instances = [ instance_id , <EOL> tiny_instance_id , <EOL> sml_instance_id , <EOL> med_instance_id , <EOL> lrg_instance_id , <EOL> xlrg_instance_id , <EOL> xxlrg_instance_id , <EOL> multi_dbs_instance_id , <EOL> req_params_instance_id , <EOL> multi_users_instance_id ] <EOL> dbaas = None <EOL> stability_mode = False <EOL> def _check_instance_attribs ( self , <EOL> instance , <EOL> exp_flavor , <EOL> exp_vol , <EOL> exp_name ) : <EOL> self . assertEqual ( instance . flavor [ '<STR_LIT:id>' ] , <EOL> str ( exp_flavor ) , <EOL> "<STR_LIT>" % ( str ( exp_flavor ) , <EOL> instance . flavor [ '<STR_LIT:id>' ] ) ) <EOL> self . assertEqual ( instance . volume [ '<STR_LIT:size>' ] , <EOL> exp_vol , <EOL> "<STR_LIT>" % ( exp_vol , <EOL> instance . volume [ '<STR_LIT:size>' ] ) ) <EOL> self . assertEqual ( instance . name , <EOL> exp_name , <EOL> "<STR_LIT>" % ( exp_name , <EOL> instance . name ) ) <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> """<STR_LIT>""" <EOL> super ( TestCreateInstances , cls ) . setUpClass ( ) <EOL> cls . dbaas = cls . client . reddwarfclient <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> """<STR_LIT>""" <EOL> dbaas = cls . dbaas <EOL> for instance_id in cls . all_instances : <EOL> if instance_id is not None : <EOL> status = cls . behavior . get_instance_status ( <EOL> dbaas , <EOL> instanceId = instance_id ) <EOL> if cls . behavior . is_instance_active ( dbaas , <EOL> instanceStatus = status ) : <EOL> dbaas . instances . get ( instance_id ) . delete ( ) <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> self . tearDownClass ( ) <EOL> def test_create_tiny_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:1> <EOL> VOLUME = <NUM_LIT:20> <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = [ { "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT:password>" } ] ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( self . behavior . found_resource ( self . dbaas , <EOL> instanceId = instance . id ) , <EOL> "<STR_LIT>" <EOL> % instance . id ) <EOL> def test_create_small_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:2> <EOL> VOLUME = <NUM_LIT> <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = [ { "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT:password>" } ] ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . sml_instance_id = instance . id <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( self . behavior . found_resource ( self . dbaas , <EOL> instanceId = instance . id ) , <EOL> "<STR_LIT>" <EOL> % instance . id ) <EOL> def test_create_medium_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:3> <EOL> VOLUME = <NUM_LIT> <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = [ { "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT:password>" } ] ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . med_instance_id = instance . id <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( self . behavior . found_resource ( self . dbaas , <EOL> instanceId = instance . id ) , <EOL> "<STR_LIT>" <EOL> % instance . id ) <EOL> def test_create_large_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:4> <EOL> VOLUME = <NUM_LIT:100> <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = [ { "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT:password>" } ] ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . lrg_instance_id = instance . id <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( self . behavior . found_resource ( self . dbaas , <EOL> instanceId = instance . id ) , <EOL> "<STR_LIT>" <EOL> % instance . id ) <EOL> def test_create_xlarge_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:5> <EOL> VOLUME = <NUM_LIT> <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = [ { "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT:password>" } ] ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . xlrg_instance_id_instance_id = instance . id <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( self . behavior . found_resource ( <EOL> self . dbaas , <EOL> instanceId = instance . id ) , <EOL> "<STR_LIT>" % instance . id ) <EOL> def test_create_xxlarge_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:6> <EOL> VOLUME = <NUM_LIT> <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = [ { "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT:password>" } ] ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . xxlrg_instance_id = instance . id <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = instance . id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( self . behavior . found_resource ( <EOL> self . dbaas , <EOL> instanceId = instance . id ) , <EOL> "<STR_LIT>" % instance . id ) <EOL> def test_create_2_dbs_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:1> <EOL> VOLUME = <NUM_LIT:10> <EOL> databases = [ { "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } , { "<STR_LIT:name>" : "<STR_LIT>" } ] <EOL> users = [ { "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } , <EOL> { "<STR_LIT:name>" : "<STR_LIT>" } ] } ] <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = databases , <EOL> users = users ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . multi_dbs_instance_id = instance . id <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = instance . id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( self . behavior . found_resource ( <EOL> self . dbaas , <EOL> instanceId = instance . id ) , <EOL> "<STR_LIT>" % instance . id ) <EOL> def test_create_2_users_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:1> <EOL> VOLUME = <NUM_LIT:10> <EOL> databases = [ { "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ] <EOL> users = [ { "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] } , <EOL> { "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] } ] <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = databases , <EOL> users = users ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . multi_users_instance_id = instance . id <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = instance . id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( <EOL> self . behavior . found_resource ( self . dbaas , instanceId = instance . id ) , <EOL> "<STR_LIT>" % instance . id ) <EOL> def test_create_required_params_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:1> <EOL> VOLUME = <NUM_LIT:10> <EOL> instance = self . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . req_params_instance_id = instance . id <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = instance . id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> instance = self . dbaas . instances . get ( instance ) <EOL> self . _check_instance_attribs ( instance , FLAVOR , VOLUME , NAME ) <EOL> self . assertTrue ( <EOL> self . behavior . found_resource ( self . dbaas , instanceId = instance . id ) , <EOL> "<STR_LIT>" % instance . id ) <EOL> class test_resize_instances ( DBaaSFixture ) : <EOL> instance_id = None <EOL> dbaas = None <EOL> class FlavorTypes ( ) : <EOL> tiny = <NUM_LIT:1> <EOL> small = <NUM_LIT:2> <EOL> med = <NUM_LIT:3> <EOL> large = <NUM_LIT:4> <EOL> xlarge = <NUM_LIT:5> <EOL> xxlarge = <NUM_LIT:6> <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> """<STR_LIT>""" <EOL> tc_name = "<STR_LIT>" <EOL> super ( test_resize_instances , cls ) . setUpClass ( ) <EOL> cls . dbaas = cls . client . reddwarfclient <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:1> <EOL> VOLUME = <NUM_LIT:10> <EOL> instance = test_resize_instances . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = [ { "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT:password>" } ] ) <EOL> httpCode = cls . behavior . get_last_response_code ( test_resize_instances <EOL> . dbaas ) <EOL> if httpCode != '<STR_LIT>' : <EOL> raise Exception ( "<STR_LIT>" % httpCode ) <EOL> test_resize_instances . instance_id = instance . id <EOL> status , elapsed_time = cls . behavior . wait_for_active ( <EOL> test_resize_instances . dbaas , <EOL> instanceId = test_resize_instances . instance_id ) <EOL> assert ( status == "<STR_LIT>" ) <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> """<STR_LIT>""" <EOL> instance_id = test_resize_instances . instance_id <EOL> dbaas = test_resize_instances . dbaas <EOL> if instance_id is not None : <EOL> status = cls . behavior . get_instance_status ( dbaas , <EOL> instanceId = instance_id ) <EOL> if cls . behavior . is_instance_active ( dbaas , instanceStatus = status ) : <EOL> dbaas . instances . get ( instance_id ) . delete ( ) <EOL> def test_resize_to_med_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_instance ( self . instance_id , <EOL> self . FlavorTypes . med ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> newFlavorSize = self . dbaas . instances . get ( self . instance_id ) . flavor [ '<STR_LIT:id>' ] <EOL> self . assertTrue ( newFlavorSize == <EOL> str ( self . FlavorTypes . med ) , <EOL> "<STR_LIT>" <EOL> % newFlavorSize ) <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_instance ( self . instance_id , <EOL> self . FlavorTypes . tiny ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> def test_resize_to_large_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_instance ( self . instance_id , <EOL> self . FlavorTypes . large ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> newFlavorSize = self . dbaas . instances . get ( self . instance_id ) . flavor [ '<STR_LIT:id>' ] <EOL> self . assertTrue ( newFlavorSize == str ( self . FlavorTypes . large ) , <EOL> "<STR_LIT>" <EOL> % newFlavorSize ) <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_instance ( self . instance_id , <EOL> self . FlavorTypes . tiny ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> def test_resize_to_xlarge_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_instance ( self . instance_id , <EOL> self . FlavorTypes . xlarge ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> newFlavorSize = self . dbaas . instances . get ( self . instance_id ) . flavor [ '<STR_LIT:id>' ] <EOL> self . assertTrue ( newFlavorSize == str ( self . FlavorTypes . xlarge ) , <EOL> "<STR_LIT>" <EOL> % newFlavorSize ) <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_instance ( self . instance_id , <EOL> self . FlavorTypes . tiny ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> def test_resize_to_xxlarge_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_instance ( self . instance_id , <EOL> self . FlavorTypes . xxlarge ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> newFlavorSize = self . dbaas . instances . get ( self . instance_id ) . flavor [ '<STR_LIT:id>' ] <EOL> self . assertTrue ( newFlavorSize == str ( self . FlavorTypes . xxlarge ) , <EOL> "<STR_LIT>" <EOL> % newFlavorSize ) <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_instance ( self . instance_id , <EOL> self . FlavorTypes . tiny ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> class test_resize_volume_instances ( DBaaSFixture ) : <EOL> instance_id = None <EOL> dbaas = None <EOL> class ResizeUpSizes ( ) : <EOL> origLevel = <NUM_LIT:10> <EOL> lev1 = <NUM_LIT:20> <EOL> lev2 = <NUM_LIT> <EOL> lev3 = <NUM_LIT> <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> """<STR_LIT>""" <EOL> super ( test_resize_volume_instances , cls ) . setUpClass ( ) <EOL> cls . dbaas = cls . client . reddwarfclient <EOL> NAME = "<STR_LIT>" <EOL> FLAVOR = <NUM_LIT:1> <EOL> VOLUME = test_resize_volume_instances . ResizeUpSizes . origLevel <EOL> instance = test_resize_volume_instances . dbaas . instances . create ( <EOL> name = NAME , <EOL> flavor_id = FLAVOR , <EOL> volume = { "<STR_LIT:size>" : VOLUME } , <EOL> databases = [ { "<STR_LIT>" : [ { "<STR_LIT:name>" : "<STR_LIT>" } ] , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT:password>" : "<STR_LIT:password>" } ] ) <EOL> httpCode = cls . behavior . get_last_response_code ( <EOL> test_resize_volume_instances . dbaas ) <EOL> if httpCode != '<STR_LIT>' : <EOL> raise Exception ( "<STR_LIT>" % httpCode ) <EOL> test_resize_volume_instances . instance_id = instance . id <EOL> status , elapsed_time = cls . behavior . wait_for_active ( <EOL> test_resize_volume_instances . dbaas , <EOL> instanceId = test_resize_volume_instances . instance_id ) <EOL> assert ( status == "<STR_LIT>" ) <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> """<STR_LIT>""" <EOL> instance_id = test_resize_volume_instances . instance_id <EOL> dbaas = test_resize_volume_instances . dbaas <EOL> if instance_id is not None : <EOL> status = cls . behavior . get_instance_status ( dbaas , <EOL> instanceId = instance_id ) <EOL> if cls . behavior . is_instance_active ( dbaas , instanceStatus = status ) : <EOL> dbaas . instances . get ( instance_id ) . delete ( ) <EOL> def test_resize_volume_instance ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_volume ( self . instance_id , <EOL> self . ResizeUpSizes . lev1 ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> newVolume = self . dbaas . instances . get ( self . instance_id ) . volume [ '<STR_LIT:size>' ] <EOL> self . assertTrue ( newVolume == self . ResizeUpSizes . lev1 , <EOL> "<STR_LIT>" <EOL> % ( self . ResizeUpSizes . lev1 , newVolume ) ) <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_volume ( self . instance_id , <EOL> self . ResizeUpSizes . lev2 ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> newVolume = self . dbaas . instances . get ( self . instance_id ) . volume [ '<STR_LIT:size>' ] <EOL> self . assertTrue ( newVolume == self . ResizeUpSizes . lev2 , <EOL> "<STR_LIT>" <EOL> % ( self . ResizeUpSizes . lev2 , newVolume ) ) <EOL> if self . behavior . is_instance_active ( self . dbaas , <EOL> instanceId = self . instance_id ) : <EOL> self . dbaas . instances . resize_volume ( self . instance_id , <EOL> self . ResizeUpSizes . lev3 ) <EOL> httpCode = self . behavior . get_last_response_code ( self . dbaas ) <EOL> self . assertTrue ( httpCode == '<STR_LIT>' , <EOL> "<STR_LIT>" % httpCode ) <EOL> status , elapsed_time = self . behavior . wait_for_active ( <EOL> self . dbaas , <EOL> instanceId = self . instance_id ) <EOL> self . assertEqual ( status , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % status ) <EOL> newVolume = self . dbaas . instances . get ( self . instance_id ) . volume [ '<STR_LIT:size>' ] <EOL> self . assertTrue ( newVolume == self . ResizeUpSizes . lev3 , <EOL> "<STR_LIT>" <EOL> % ( self . ResizeUpSizes . lev3 , newVolume ) ) </s>
