Exemplo n.º 1
0
    def test_generate_deployment_params(self):
        # this method is fairly light, so just make sure that it constructs the dict
        # to send to the AppController correctly
        options = flexmock(name='options',
                           table='cassandra',
                           keyname='boo',
                           appengine='1',
                           autoscale=False,
                           group='bazgroup',
                           replication=None,
                           infrastructure='ec2',
                           machine='ami-ABCDEFG',
                           instance_type='m1.large',
                           use_spot_instances=True,
                           max_spot_price=1.23,
                           clear_datastore=False,
                           disks={'node-1': 'vol-ABCDEFG'},
                           zone='my-zone-1b',
                           verbose=True,
                           user_commands=[],
                           flower_password="******",
                           max_memory=ParseArgs.DEFAULT_MAX_MEMORY)
        node_layout = NodeLayout({
            'table': 'cassandra',
            'infrastructure': "ec2",
            'min': 1,
            'max': 1
        })

        flexmock(NodeLayout).should_receive("head_node").and_return(
            SimpleNode('public1', 'some cloud', ['some role']))

        expected = {
            'table': 'cassandra',
            'login': '******',
            'clear_datastore': 'False',
            'keyname': 'boo',
            'appengine': '1',
            'autoscale': 'False',
            'replication': 'None',
            'group': 'bazgroup',
            'machine': 'ami-ABCDEFG',
            'infrastructure': 'ec2',
            'instance_type': 'm1.large',
            'min_images': '1',
            'max_images': '1',
            'use_spot_instances': 'True',
            'user_commands': json.dumps([]),
            'max_spot_price': '1.23',
            'zone': 'my-zone-1b',
            'verbose': 'True',
            'flower_password': '******',
            'max_memory': str(ParseArgs.DEFAULT_MAX_MEMORY)
        }
        actual = LocalState.generate_deployment_params(
            options, node_layout, {'max_spot_price': '1.23'})
        self.assertEquals(expected, actual)
Exemplo n.º 2
0
  def test_generate_deployment_params(self):
    # this method is fairly light, so just make sure that it constructs the dict
    # to send to the AppController correctly
    options = flexmock(
      name='options', table='cassandra', keyname='boo',
      default_min_appservers='1', autoscale=False, group='bazgroup',
      replication=None, infrastructure='ec2', machine='ami-ABCDEFG',
      instance_type='m1.large', use_spot_instances=True, max_spot_price=1.23,
      clear_datastore=False, disks={'node-1' : 'vol-ABCDEFG'},
      zone='my-zone-1b', verbose=True, user_commands=[], flower_password="******",
      default_max_appserver_memory=ParseArgs.DEFAULT_MAX_APPSERVER_MEMORY,
      EC2_ACCESS_KEY='baz', EC2_SECRET_KEY='baz', EC2_URL='',
      login_host='public1', aws_subnet_id=None, aws_vpc_id=None)
    node_layout = NodeLayout({
      'table' : 'cassandra',
      'infrastructure' : "ec2",
      'min_machines' : 1,
      'max_machines' : 1,
      'instance_type': 'm1.large'
    })

    flexmock(NodeLayout).should_receive("head_node").and_return(Node(
      'public1', 'some cloud', ['some role']))

    expected = {
      'table' : 'cassandra',
      'login' : 'public1',
      'clear_datastore': 'False',
      'keyname' : 'boo',
      'default_min_appservers' : '1',
      'autoscale' : 'False',
      'replication': 'None',
      'group' : 'bazgroup',
      'machine' : 'ami-ABCDEFG',
      'infrastructure' : 'ec2',
      'instance_type' : 'm1.large',
      'min_machines' : '1',
      'max_machines' : '1',
      'use_spot_instances' : 'True',
      'user_commands' : json.dumps([]),
      'max_spot_price' : '1.23',
      'zone' : 'my-zone-1b',
      'verbose' : 'True',
      'flower_password' : 'abc',
      'default_max_appserver_memory' : str(ParseArgs.DEFAULT_MAX_APPSERVER_MEMORY),
      'EC2_ACCESS_KEY': 'baz',
      'EC2_SECRET_KEY': 'baz',
      'EC2_URL': '',
      'aws_subnet_id': None,
      'aws_vpc_id': None
    }
    actual = LocalState.generate_deployment_params(options, node_layout,
      {'max_spot_price':'1.23'})
    self.assertEquals(expected, actual)
    def test_generate_deployment_params(self):
        # this method is fairly light, so just make sure that it constructs the dict
        # to send to the AppController correctly
        options = flexmock(name='options',
                           table='cassandra',
                           keyname='boo',
                           default_min_appservers='1',
                           autoscale=False,
                           group='bazgroup',
                           replication=None,
                           infrastructure='ec2',
                           machine='ami-ABCDEFG',
                           instance_type='m1.large',
                           use_spot_instances=True,
                           max_spot_price=1.23,
                           clear_datastore=False,
                           disks={'node-1': 'vol-ABCDEFG'},
                           zone='my-zone-1b',
                           verbose=True,
                           user_commands=[],
                           flower_password="******",
                           default_max_appserver_memory=ParseArgs.
                           DEFAULT_MAX_APPSERVER_MEMORY,
                           EC2_ACCESS_KEY='baz',
                           EC2_SECRET_KEY='baz',
                           EC2_URL='',
                           login_host='public1',
                           aws_subnet_id=None,
                           aws_vpc_id=None,
                           fdb_clusterfile_content=None,
                           postgres_dsn=None,
                           update='code_dir')
        node_layout = NodeLayout({
            'table': 'cassandra',
            'infrastructure': "ec2",
            'min_machines': 1,
            'max_machines': 1,
            'instance_type': 'm1.large'
        })

        flexmock(NodeLayout).should_receive("head_node").and_return(
            Node('public1', 'some cloud', ['some role']))

        expected = {
            'table':
            'cassandra',
            'login':
            '******',
            'clear_datastore':
            'False',
            'keyname':
            'boo',
            'default_min_appservers':
            '1',
            'autoscale':
            'False',
            'replication':
            'None',
            'group':
            'bazgroup',
            'machine':
            'ami-ABCDEFG',
            'infrastructure':
            'ec2',
            'instance_type':
            'm1.large',
            'min_machines':
            '1',
            'max_machines':
            '1',
            'use_spot_instances':
            'True',
            'user_commands':
            json.dumps([]),
            'max_spot_price':
            '1.23',
            'zone':
            'my-zone-1b',
            'verbose':
            'True',
            'flower_password':
            '******',
            'default_max_appserver_memory':
            str(ParseArgs.DEFAULT_MAX_APPSERVER_MEMORY),
            'EC2_ACCESS_KEY':
            'baz',
            'EC2_SECRET_KEY':
            'baz',
            'EC2_URL':
            '',
            'aws_subnet_id':
            None,
            'aws_vpc_id':
            None,
            'fdb_clusterfile_content':
            None,
            'postgres_dsn':
            None,
            'update':
            'code_dir'
        }
        actual = LocalState.generate_deployment_params(
            options, node_layout, {'max_spot_price': '1.23'})
        self.assertEquals(expected, actual)