def pre_initializations(context): # context.user is admin and regular user provider = ProviderFactory.create() from core.models import IdentityMembership, Identity, ProviderMachine user_group = IdentityMembership.objects.all() if not user_group: user_identity = IdentityFactory.create_identity( created_by=context.user, provider=provider) else: user_identity = Identity.objects.all().last() provider_machine = ProviderMachine.objects.all() if not provider_machine: machine = ProviderMachineFactory.create_provider_machine( context.user, user_identity) else: machine = ProviderMachine.objects.all().last() context.active_instance = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=machine.instance_source, created_by=context.user, created_by_identity=user_identity, start_date=timezone.now()) active = InstanceStatusFactory.create(name='active') InstanceHistoryFactory.create(status=active, activity="", instance=context.active_instance)
def pre_initializations(context): # context.user is admin and regular user provider = ProviderFactory.create() from core.models import IdentityMembership, Identity, ProviderMachine user_group = IdentityMembership.objects.all() if not user_group: user_identity = IdentityFactory.create_identity( created_by=context.user, provider=provider ) else: user_identity = Identity.objects.all().last() provider_machine = ProviderMachine.objects.all() if not provider_machine: machine = ProviderMachineFactory.create_provider_machine( context.user, user_identity ) else: machine = ProviderMachine.objects.all().last() context.active_instance = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=machine.instance_source, created_by=context.user, created_by_identity=user_identity, start_date=timezone.now() ) active = InstanceStatusFactory.create(name='active') InstanceHistoryFactory.create( status=active, activity="", instance=context.active_instance )
def setUp(self): self.anonymous_user = AnonymousUserFactory() self.user = UserFactory.create(username='******') self.provider = ProviderFactory.create(type__name='mock') self.user_identity = IdentityFactory.create_identity( created_by=self.user, provider=self.provider) self.machine = ProviderMachineFactory.create_provider_machine( self.user, self.user_identity) start_date = timezone.now() self.active_instance = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=start_date) self.status_active = InstanceStatusFactory.create(name='active') delta_time = timezone.timedelta(minutes=2) InstanceHistoryFactory.create(status=self.status_active, activity="", instance=self.active_instance, start_date=start_date + delta_time * 3) self.view = InstanceViewSet.as_view({'post': 'actions'}) self.url = reverse('api:v2:instance-list') self.url += "/" + str(self.active_instance.provider_alias) + "/actions" self.mock_driver = get_esh_driver(self.user_identity) self.mock_driver.add_core_instance(self.active_instance) start_date_second = timezone.now() self.active_instance_second = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=start_date_second) self.status_active_second = InstanceStatusFactory.create(name='active') delta_time = timezone.timedelta(minutes=2) self.size_small = SizeFactory.create(provider=self.provider, cpu=2, disk=20, root=0, mem=128) self.size_large = SizeFactory.create(provider=self.provider, cpu=4, disk=40, root=0, mem=256) InstanceHistoryFactory.create(status=self.status_active_second, size=self.size_small, activity="", instance=self.active_instance_second, start_date=start_date_second + delta_time * 3) self.mock_driver_second = get_esh_driver(self.user_identity) self.mock_driver.add_core_instance(self.active_instance_second)
def launch_instance_history(instance_state, cpu, provider, status, time_created): size = Size(alias=uuid.uuid4(), name='small', provider=provider, cpu=cpu, disk=1, root=1, mem=1) size.save() InstanceHistoryFactory.create( status=status, activity="", instance=instance_state, start_date=time_created, size=size ) return instance_state.provider_alias
def launch_instance_history(instance_state, cpu, provider, status, time_created): size = Size(alias=uuid.uuid4(), name='small', provider=provider, cpu=cpu, disk=1, root=1, mem=1) size.save() InstanceHistoryFactory.create( status=status, activity="", instance=instance_state, start_date=time_created, size=size ) return instance_state.provider_alias
def launch_instance(user, time_created, cpu): # context.user is admin and regular user provider = ProviderFactory.create() from core.models import IdentityMembership, Identity user_group = IdentityMembership.objects.filter(member__name=user.username) if not user_group: user_identity = IdentityFactory.create_identity( created_by=user, provider=provider ) else: user_identity = Identity.objects.all().last() provider_machine = ProviderMachine.objects.all() if not provider_machine: machine = ProviderMachineFactory.create_provider_machine( user, user_identity ) else: machine = ProviderMachine.objects.all().last() status = InstanceStatusFactory.create(name='active') instance_state = InstanceFactory.create( provider_alias=uuid.uuid4(), source=machine.instance_source, created_by=user, created_by_identity=user_identity, start_date=time_created ) size = Size( alias=uuid.uuid4(), name='small', provider=provider, cpu=cpu, disk=1, root=1, mem=1 ) size.save() InstanceHistoryFactory.create( status=status, activity="", instance=instance_state, start_date=time_created, end_date=time_created + timedelta(minutes=30), size=size ) return instance_state.provider_alias
def change_instance_status(user, provider_alias, time_stopped, new_status): active_instance = Instance.objects.filter( provider_alias=provider_alias).last() size = Size.objects.all().last() status_history = InstanceStatusHistory.objects.filter( instance=active_instance).last() status_history.end_date = time_stopped status_history.save() status = get_instance_state_from_factory(new_status) InstanceHistoryFactory.create(status=status, activity="", instance=active_instance, start_date=time_stopped, size=size)
def change_instance_status(user, provider_alias, time_stopped, new_status): active_instance = Instance.objects.filter(provider_alias=provider_alias).last() size = Size.objects.all().last() status_history = InstanceStatusHistory.objects.filter(instance=active_instance).last() status_history.end_date = time_stopped status_history.save() status = get_instance_state_from_factory(new_status) InstanceHistoryFactory.create( status=status, activity="", instance=active_instance, start_date=time_stopped, size=size )
def launch_instance(user, time_created, cpu): # context.user is admin and regular user provider = ProviderFactory.create() from core.models import IdentityMembership, Identity user_group = IdentityMembership.objects.filter(member__name=user.username) if not user_group: user_identity = IdentityFactory.create_identity(created_by=user, provider=provider) else: user_identity = Identity.objects.all().last() admin_identity = user_identity provider_machine = ProviderMachine.objects.all() if not provider_machine: machine = ProviderMachineFactory.create_provider_machine( user, user_identity) else: machine = ProviderMachine.objects.all().last() status = InstanceStatusFactory.create(name='active') instance_state = InstanceFactory.create(provider_alias=uuid.uuid4(), source=machine.instance_source, created_by=user, created_by_identity=user_identity, start_date=time_created) size = Size(alias=uuid.uuid4(), name='small', provider=provider, cpu=cpu, disk=1, root=1, mem=1) size.save() InstanceHistoryFactory.create(status=status, activity="", instance=instance_state, start_date=time_created, end_date=time_created + timedelta(minutes=30), size=size) return instance_state.provider_alias
def setUp(self): self.list_view = InstanceViewSet.as_view({'get': 'list'}) self.detailed_view = InstanceViewSet.as_view({'get': 'retrieve'}) self.anonymous_user = AnonymousUserFactory() self.user = UserFactory.create(username='******') self.admin_user = UserFactory.create(username='******', is_superuser=True, is_staff=True) self.provider = ProviderFactory.create() self.user_identity = IdentityFactory.create_identity( created_by=self.user, provider=self.provider) self.admin_identity = IdentityFactory.create_identity( provider=self.provider, created_by=self.admin_user) self.machine = ProviderMachineFactory.create_provider_machine(self.user, self.user_identity) self.active_instance = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=timezone.now()) self.networking_instance = InstanceFactory.create( name="Instance in networking", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=timezone.now()) self.deploying_instance = InstanceFactory.create( name="Instance in deploying", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=timezone.now()) self.deploy_error_instance = InstanceFactory.create( name="Instance in deploy_error", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=timezone.now()) active = InstanceStatusFactory.create(name='active') networking = InstanceStatusFactory.create(name='networking') deploying = InstanceStatusFactory.create(name='deploying') deploy_error = InstanceStatusFactory.create(name='deploy_error') InstanceHistoryFactory.create( status=deploy_error, activity="", instance=self.deploy_error_instance ) InstanceHistoryFactory.create( status=deploying, activity="", instance=self.deploying_instance ) InstanceHistoryFactory.create( status=active, activity="", instance=self.active_instance ) InstanceHistoryFactory.create( status=networking, activity="", instance=self.networking_instance )
def setUp(self): self.anonymous_user = AnonymousUserFactory() self.user = UserFactory.create(username='******') self.provider = ProviderFactory.create(type__name='mock') self.user_identity = IdentityFactory.create_identity( created_by=self.user, provider=self.provider ) self.machine = ProviderMachineFactory.create_provider_machine( self.user, self.user_identity ) start_date = timezone.now() self.active_instance = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=start_date ) self.size_small = SizeFactory.create( provider=self.provider, cpu=2, disk=20, root=0, mem=128 ) self.status_active = InstanceStatusFactory.create(name='active') delta_time = timezone.timedelta(minutes=2) InstanceHistoryFactory.create( status=self.status_active, size=self.size_small, activity="", instance=self.active_instance, start_date=start_date + delta_time * 3 ) self.view = InstanceViewSet.as_view({'post': 'actions'}) self.url = reverse('api:v2:instance-list') self.url += "/" + str(self.active_instance.provider_alias) + "/actions" self.mock_driver = get_esh_driver(self.user_identity) self.mock_driver.add_core_instance(self.active_instance) start_date_second = timezone.now() self.active_instance_second = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=start_date_second ) delta_time = timezone.timedelta(minutes=2) self.size_small = SizeFactory.create( provider=self.provider, cpu=2, disk=20, root=0, mem=128 ) self.size_large = SizeFactory.create( provider=self.provider, cpu=4, disk=40, root=0, mem=256 ) InstanceHistoryFactory.create( status=self.status_active, size=self.size_small, activity="", instance=self.active_instance_second, start_date=start_date_second + delta_time * 3 ) self.mock_driver.add_core_instance(self.active_instance_second) self.allocation_source_1 = AllocationSourceFactory.create( name='TEST_INSTANCE_ALLOCATION_SOURCE_01', compute_allowed=1000 ) UserAllocationSource.objects.create( allocation_source=self.allocation_source_1, user=self.user ) UserAllocationSnapshot.objects.create( allocation_source=self.allocation_source_1, user=self.user, burn_rate=1, compute_used=0 ) AllocationSourceSnapshot.objects.create( allocation_source=self.allocation_source_1, compute_used=0, compute_allowed=168, global_burn_rate=1 ) InstanceAllocationSourceSnapshot.objects.update_or_create( instance=self.active_instance, allocation_source=self.allocation_source_1 )
def setUp(self): self.list_view = ViewSet.as_view({'get': 'list'}) self.detailed_view = ViewSet.as_view({'get': 'retrieve'}) self.anonymous_user = AnonymousUserFactory() self.user = UserFactory.create(username='******') self.staff_user = UserFactory.create(username='******', is_staff=True, is_superuser=True) self.provider = ProviderFactory.create() self.user_identity = IdentityFactory.create_identity( created_by=self.user, provider=self.provider) self.staff_user_identity = IdentityFactory.create_identity( created_by=self.staff_user, provider=self.provider) self.machine = ProviderMachineFactory.create_provider_machine(self.staff_user, self.staff_user_identity) self.application = self.machine.application_version.application start_date = timezone.now() self.active_instance = InstanceFactory.create( name="Instance went active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.staff_user_identity, start_date=start_date) self.networking_instance = InstanceFactory.create( name="Instance stuck in networking", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.staff_user_identity, start_date=start_date) self.deploying_instance = InstanceFactory.create( name="Instance stuck in deploying", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.staff_user_identity, start_date=start_date) self.deploy_error_instance = InstanceFactory.create( name="Instance stuck in deploy_error", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.staff_user_identity, start_date=start_date) self.status_build = InstanceStatusFactory.create(name='build') self.status_suspended = InstanceStatusFactory.create(name='suspended') self.status_active = InstanceStatusFactory.create(name='active') self.status_networking = InstanceStatusFactory.create(name='networking') self.status_deploying = InstanceStatusFactory.create(name='deploying') self.status_deploy_error = InstanceStatusFactory.create(name='deploy_error') # Adding two minutes to simulate the passage of time. delta_time = timezone.timedelta(minutes=2) # Simulate 'Deploy error' InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.deploy_error_instance, start_date=start_date, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.deploy_error_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_deploying, activity="", instance=self.deploy_error_instance, start_date=start_date + delta_time*2, ) InstanceHistoryFactory.create( status=self.status_deploy_error, activity="", instance=self.deploy_error_instance, start_date=start_date + delta_time*3, ) # Simulate 'stuck in networking' InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.networking_instance, start_date=start_date, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.networking_instance, start_date=start_date + delta_time, ) # Simulate 'stuck in deploying' InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.deploying_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.deploying_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_deploying, activity="", instance=self.deploying_instance, start_date=start_date + delta_time, ) # Simulate going to active InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.active_instance, start_date=start_date, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.active_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_deploying, activity="", instance=self.active_instance, start_date=start_date + delta_time*2, ) InstanceHistoryFactory.create( status=self.status_active, activity="", instance=self.active_instance, start_date=start_date + delta_time*3, ) get_application_metrics(self.application)
def test_complex_instance_affect_on_metrics(self): """ If an instance *was* active, then *suspended*, then *never makes it back to active*, how should we measure the statistics? """ start_date = timezone.now() # Adding two minutes to simulate the passage of time. delta_time = timezone.timedelta(minutes=2) self.complex_instance = InstanceFactory.create( name="Instance went active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.user_identity, start_date=start_date) # Simulate going to active InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.complex_instance, start_date=start_date, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.complex_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_deploying, activity="", instance=self.complex_instance, start_date=start_date + delta_time*2, ) InstanceHistoryFactory.create( status=self.status_active, activity="", instance=self.complex_instance, start_date=start_date + delta_time*3, ) InstanceHistoryFactory.create( status=self.status_suspended, activity="", instance=self.complex_instance, start_date=start_date + delta_time*4, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.complex_instance, start_date=start_date + delta_time*5, ) InstanceHistoryFactory.create( status=self.status_deploy_error, activity="", instance=self.complex_instance, start_date=start_date + delta_time*6, )
def setUp(self): self.anonymous_user = AnonymousUserFactory() self.user = UserFactory.create(username='******') self.provider = ProviderFactory.create(type__name='mock') self.user_identity = IdentityFactory.create_identity( created_by=self.user, provider=self.provider) self.machine = ProviderMachineFactory.create_provider_machine(self.user, self.user_identity) start_date = timezone.now() self.active_instance = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=start_date) self.size_small = SizeFactory.create(provider=self.provider, cpu=2, disk=20, root=0, mem=128) self.status_active = InstanceStatusFactory.create(name='active') delta_time = timezone.timedelta(minutes=2) InstanceHistoryFactory.create( status=self.status_active, size=self.size_small, activity="", instance=self.active_instance, start_date=start_date + delta_time*3) self.view = InstanceViewSet.as_view({'post': 'actions'}) self.url = reverse('api:v2:instance-list') self.url += "/" + str(self.active_instance.provider_alias) + "/actions" self.mock_driver = get_esh_driver(self.user_identity) self.mock_driver.add_core_instance(self.active_instance) start_date_second = timezone.now() self.active_instance_second = InstanceFactory.create( name="Instance in active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.user, created_by_identity=self.user_identity, start_date=start_date_second) delta_time = timezone.timedelta(minutes=2) self.size_small = SizeFactory.create(provider=self.provider, cpu=2, disk=20, root=0, mem=128) self.size_large = SizeFactory.create(provider=self.provider, cpu=4, disk=40, root=0, mem=256) InstanceHistoryFactory.create( status=self.status_active, size=self.size_small, activity="", instance=self.active_instance_second, start_date=start_date_second + delta_time*3) self.mock_driver.add_core_instance(self.active_instance_second) self.allocation_source_1 = AllocationSourceFactory.create(name='TEST_INSTANCE_ALLOCATION_SOURCE_01', compute_allowed=1000) UserAllocationSource.objects.create( allocation_source=self.allocation_source_1, user=self.user) UserAllocationSnapshot.objects.create( allocation_source=self.allocation_source_1, user=self.user, burn_rate=1, compute_used=0) AllocationSourceSnapshot.objects.create( allocation_source=self.allocation_source_1, compute_used=0, compute_allowed=168, global_burn_rate=1 ) InstanceAllocationSourceSnapshot.objects.update_or_create(instance=self.active_instance, allocation_source=self.allocation_source_1)
def test_complex_instance_affect_on_metrics(self): """ If an instance *was* active, then *suspended*, then *never makes it back to active*, how should we measure the statistics? """ start_date = timezone.now() # Adding two minutes to simulate the passage of time. delta_time = timezone.timedelta(minutes=2) self.complex_instance = InstanceFactory.create( name="Instance went active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.user_identity, start_date=start_date ) # Simulate going to active InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.complex_instance, start_date=start_date, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.complex_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_deploying, activity="", instance=self.complex_instance, start_date=start_date + delta_time * 2, ) InstanceHistoryFactory.create( status=self.status_active, activity="", instance=self.complex_instance, start_date=start_date + delta_time * 3, ) InstanceHistoryFactory.create( status=self.status_suspended, activity="", instance=self.complex_instance, start_date=start_date + delta_time * 4, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.complex_instance, start_date=start_date + delta_time * 5, ) InstanceHistoryFactory.create( status=self.status_deploy_error, activity="", instance=self.complex_instance, start_date=start_date + delta_time * 6, )
def setUp(self): self.list_view = ViewSet.as_view({'get': 'list'}) self.detailed_view = ViewSet.as_view({'get': 'retrieve'}) self.anonymous_user = AnonymousUserFactory() self.user = UserFactory.create(username='******') self.staff_user = UserFactory.create( username='******', is_staff=True, is_superuser=True ) self.provider = ProviderFactory.create() self.user_identity = IdentityFactory.create_identity( created_by=self.user, provider=self.provider ) self.staff_user_identity = IdentityFactory.create_identity( created_by=self.staff_user, provider=self.provider ) self.machine = ProviderMachineFactory.create_provider_machine( self.staff_user, self.staff_user_identity ) self.application = self.machine.application_version.application start_date = timezone.now() self.active_instance = InstanceFactory.create( name="Instance went active", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.staff_user_identity, start_date=start_date ) self.networking_instance = InstanceFactory.create( name="Instance stuck in networking", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.staff_user_identity, start_date=start_date ) self.deploying_instance = InstanceFactory.create( name="Instance stuck in deploying", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.staff_user_identity, start_date=start_date ) self.deploy_error_instance = InstanceFactory.create( name="Instance stuck in deploy_error", provider_alias=uuid.uuid4(), source=self.machine.instance_source, created_by=self.staff_user, created_by_identity=self.staff_user_identity, start_date=start_date ) self.status_build = InstanceStatusFactory.create(name='build') self.status_suspended = InstanceStatusFactory.create(name='suspended') self.status_active = InstanceStatusFactory.create(name='active') self.status_networking = InstanceStatusFactory.create(name='networking') self.status_deploying = InstanceStatusFactory.create(name='deploying') self.status_deploy_error = InstanceStatusFactory.create( name='deploy_error' ) # Adding two minutes to simulate the passage of time. delta_time = timezone.timedelta(minutes=2) # Simulate 'Deploy error' InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.deploy_error_instance, start_date=start_date, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.deploy_error_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_deploying, activity="", instance=self.deploy_error_instance, start_date=start_date + delta_time * 2, ) InstanceHistoryFactory.create( status=self.status_deploy_error, activity="", instance=self.deploy_error_instance, start_date=start_date + delta_time * 3, ) # Simulate 'stuck in networking' InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.networking_instance, start_date=start_date, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.networking_instance, start_date=start_date + delta_time, ) # Simulate 'stuck in deploying' InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.deploying_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.deploying_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_deploying, activity="", instance=self.deploying_instance, start_date=start_date + delta_time, ) # Simulate going to active InstanceHistoryFactory.create( status=self.status_build, activity="", instance=self.active_instance, start_date=start_date, ) InstanceHistoryFactory.create( status=self.status_networking, activity="", instance=self.active_instance, start_date=start_date + delta_time, ) InstanceHistoryFactory.create( status=self.status_deploying, activity="", instance=self.active_instance, start_date=start_date + delta_time * 2, ) InstanceHistoryFactory.create( status=self.status_active, activity="", instance=self.active_instance, start_date=start_date + delta_time * 3, )