示例#1
0
 def test_update_app(self):
     client = VPC()
     client.login('*****@*****.**', 'cloud9ers')
     #self.assertEqual(1, len(client.apps()))
     #name = 'test_%s' % uuid4()
     #manifest = {
     #            'name' : name,
     #            'uris' : ['%s.cloudfoundry.com' % name],
     #            'instances' : 1,
     #            'runningInstances': 1,
     #            'staging' : { 'model' : 'sinatra', 'stack': 'ruby18' },
     #            'resources' : { 'memory': 64 }
     #            }
     #status, _, _ = client.create_apps(name, manifest)
     #self.assertEqual('302', status)
     #self.assertEqual(2, len(client.apps()))
     name = 'ruby-foo-c9'
     manifest = {"env":[],
                 "uris":["ruby-foo-c9.cloudfoundry.com"],
                 "runningInstances":1,
                 "instances":3,
                 "name":"ruby-foo-c9"}
     status, _, _ = client.update_app(name, manifest)
     self.assertEqual('200', status)
     apps_info = client.apps() 
     self.assertEqual(3, apps_info[-1]['instances'])
示例#2
0
 def test_update_info(self):
     client = VPC()
     client.login('*****@*****.**', 'cloud9ers')
     #name = 'test_%s' % uuid4()
     #manifest = {
     #            'name' : name,
     #            'uris' : ['%s.cloudfoundry.com' % name],
     #            'instances' : 1,
     #            'state': 'STARTED',
     #            'staging' : { 'model' : 'sinatra', 'stack': 'ruby18' },
     #            'resources' : { 'memory': 128 }
     #            }
     #status, _, _ = client.create_apps(name, manifest)
     #apps_info = client.apps()
     #self.assertEqual(2, len(apps_info))
     #self.assertEqual('302', status)
     name = 'ruby-foo-c9'
     manifest = {
                 'name' : name,
                 'uris' : ['%s.cloudfoundry.com' % name],
                 'instances' : 3,
                 'runningInstances': 1,
                 'staging' : { 'model' : 'sinatra', 'stack': 'ruby18' },
                 'resources' : { 'memory': 128 }
                 }
     status, _, _ = client.update_app(name, manifest)
     self.assertEqual('200', status)
     update_info = client.app_update_info(name)
     self.assertEqual('UPDATING', update_info['state'])
     #path =  '%s/%s' %(constants.APPS_PATH, apps_info[-1]['name'])
     #client.delete_app(path)           
     #apps_info = client.apps()
     #self.assertEqual(1, len(apps_info))
     manifest = {
                 'name' : name,
                 'uris' : ['%s.cloudfoundry.com' % name],
                 'instances' : 1,
                 'runningInstances': 1,
                 'staging' : { 'model' : 'sinatra', 'stack': 'ruby18' },
                 'resources' : { 'memory': 128 }
                 }
     status, _, _ = client.update_app(name, manifest)
     self.assertEqual('200', status)
     update_info = client.app_update_info(name)
     self.assertEqual('SUCCEEDED', update_info['state'])