Ejemplo n.º 1
0
  def test_matches(self):
    """Ensures that maximum_size and minimum_size are both made to match."""
    manager_cfg = config_pb2.InstanceGroupManagerConfig.InstanceGroupManager(
        maximum_size=3,
        minimum_size=2,
        template_base_name='base-name',
        zone='zone',
    )
    instance_group_manager = models.InstanceGroupManager(
        maximum_size=manager_cfg.maximum_size + 1,
        minimum_size=manager_cfg.minimum_size - 1,
    )

    self.failUnless(parse.ensure_instance_group_manager_matches(
        manager_cfg, instance_group_manager))
    self.assertEqual(
        instance_group_manager.maximum_size, manager_cfg.maximum_size)
    self.assertEqual(
        instance_group_manager.minimum_size, manager_cfg.minimum_size)
Ejemplo n.º 2
0
  def test_already_matches(self):
    """Ensures that nothing changes when instance group manager matches."""
    manager_cfg = config_pb2.InstanceGroupManagerConfig.InstanceGroupManager(
        maximum_size=3,
        minimum_size=2,
        template_base_name='base-name',
        zone='zone',
    )
    instance_group_manager = models.InstanceGroupManager(
        maximum_size=manager_cfg.maximum_size,
        minimum_size=manager_cfg.minimum_size,
    )

    self.failIf(parse.ensure_instance_group_manager_matches(
        manager_cfg, instance_group_manager))
    self.assertEqual(
        instance_group_manager.maximum_size, manager_cfg.maximum_size)
    self.assertEqual(
        instance_group_manager.minimum_size, manager_cfg.minimum_size)
Ejemplo n.º 3
0
    def test_matches(self):
        """Ensures that maximum_size and minimum_size are both made to match."""
        manager_cfg = config_pb2.InstanceGroupManagerConfig.InstanceGroupManager(
            maximum_size=3,
            minimum_size=2,
            template_base_name='base-name',
            zone='zone',
        )
        instance_group_manager = models.InstanceGroupManager(
            maximum_size=manager_cfg.maximum_size + 1,
            minimum_size=manager_cfg.minimum_size - 1,
        )

        self.failUnless(
            parse.ensure_instance_group_manager_matches(
                manager_cfg, instance_group_manager))
        self.assertEqual(instance_group_manager.maximum_size,
                         manager_cfg.maximum_size)
        self.assertEqual(instance_group_manager.minimum_size,
                         manager_cfg.minimum_size)
Ejemplo n.º 4
0
    def test_already_matches(self):
        """Ensures that nothing changes when instance group manager matches."""
        manager_cfg = config_pb2.InstanceGroupManagerConfig.InstanceGroupManager(
            maximum_size=3,
            minimum_size=2,
            template_base_name='base-name',
            zone='zone',
        )
        instance_group_manager = models.InstanceGroupManager(
            maximum_size=manager_cfg.maximum_size,
            minimum_size=manager_cfg.minimum_size,
        )

        self.failIf(
            parse.ensure_instance_group_manager_matches(
                manager_cfg, instance_group_manager))
        self.assertEqual(instance_group_manager.maximum_size,
                         manager_cfg.maximum_size)
        self.assertEqual(instance_group_manager.minimum_size,
                         manager_cfg.minimum_size)