def test_run_plan_migration(self):

        backend_settings = BackendRunPlanSettings(backend=self.backend,
                                                  package=self.pkg,
                                                  socket=8080, stats=9090,
                                                  workers_min=1, workers_max=4)

        run_plan = ApplicationRunPlan(application=self.app,
                                      backends=[backend_settings],
                                      workers_min=1, workers_max=4,
                                      memory_per_worker=128, max_log_size=1)
        run_plan.save()

        self.app.reload()
        self.assertEqual(self.app.run_plan, None)
        self.assertEqual(call_command('migrate_db'), None)
        self.app.reload()
        self.assertEqual(self.app.run_plan, run_plan)

        run_plan.delete()
Example #2
0
def create_run_plan_pkg_list(request):
    create_app(request)
    create_pkg_list(request)
    create_backend(request)
    create_router(request)

    backend_settings = BackendRunPlanSettings(
        backend=request.instance.backend, package=request.instance.pkg_list[0],
        socket=8080, stats=9090, workers_min=1, workers_max=4)

    run_plan = ApplicationRunPlan(application=request.instance.app,
                                  backends=[backend_settings],
                                  workers_min=1, workers_max=4,
                                  memory_per_worker=128, max_log_size=1)
    run_plan.save()
    request.instance.app.update(set__run_plan=run_plan)
    request.instance.app.reload()

    def cleanup():
        run_plan.delete()
    request.addfinalizer(cleanup)

    request.instance.run_plan = run_plan