Exemplo n.º 1
0
 def test_init_with_string_roll_settings(self):
     with self.assertRaises(exceptions.InvalidOptions):
         self.actor = spotinst.ElastiGroup(
             options={
                 'name': 'unittest',
                 'config': 'junk',
                 'roll_batch_size': 'some_number'
             })
Exemplo n.º 2
0
 def integration_09a_delete_elastigroup(self):
     actor = spotinst.ElastiGroup(dry=False,
                                  init_tokens=os.environ,
                                  options={
                                      'name': self.group_name,
                                      'state': 'absent',
                                      'config': self.config,
                                  })
     res = yield actor.execute()
     self.assertEquals(res, None)
Exemplo n.º 3
0
 def integration_01a_create_elastigroup_dry(self):
     actor = spotinst.ElastiGroup(dry=True,
                                  init_tokens=os.environ,
                                  options={
                                      'name': self.group_name,
                                      'state': 'present',
                                      'config': self.config,
                                      'wait_on_create': True,
                                  })
     res = yield actor.execute()
     self.assertEquals(res, None)
Exemplo n.º 4
0
    def integration_02b_update_elastigroup(self):
        actor = spotinst.ElastiGroup(dry=False,
                                     init_tokens=os.environ,
                                     options={
                                         'name': self.group_name,
                                         'state': 'present',
                                         'config': self.config,
                                         'roll_on_change': True,
                                         'wait_on_roll': True,
                                         'roll_batch_size': 99,
                                         'roll_grace_period': 60,
                                     })

        # Patch the group description to trigger an update
        actor._config['group']['description'] = UUID
        res = yield actor.execute()
        self.assertEquals(res, None)
Exemplo n.º 5
0
    def setUp(self, *args, **kwargs):
        super(TestElastiGroup, self).setUp(*args, **kwargs)
        file = 'examples/test/spotinst.elastigroup/unittest.json'
        spotinst.TOKEN = 'Unittest'

        # Manually inject some fake values for the subnet/secgrp/zone
        init_tokens = {
            'SECGRP': 'sg-123123',
            'ZONE': 'us-test-1a',
            'SUBNET': 'sn-123123'
        }

        self.actor = spotinst.ElastiGroup(
            'unittest',
            {'name': 'unittest',
             'config': file,
             'wait_on_create': True,
             'wait_on_roll': True},
            init_tokens=init_tokens)
        self.actor._client = mock.Mock()