Commit d43a3021 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Update stress test to use the new transaction decorator

parent 0189a7fe
......@@ -50,6 +50,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'synnefo.settings'
from astakos.im.api.callpoint import AstakosCallpoint
from astakos.im.functions import get_chain_of_application_id
from views import submit, approve, join, leave
from synnefo.lib.db.transaction import commit_on_success_strict
USERS = {}
PROJECTS = {}
......@@ -87,6 +88,7 @@ def new_user():
return r.data['id'], email
@commit_on_success_strict()
def new_users(count):
for i in range(count):
uid, email = new_user()
......
......@@ -33,25 +33,20 @@
from datetime import datetime, timedelta
from astakos.im.models import AstakosUser, PendingMembershipError
from astakos.im.models import AstakosUser
from astakos.im.functions import (join_project, leave_project,
submit_application, approve_application)
from astakos.im.project_xctx import cmd_project_transaction_context
from astakos.im.retry_xctx import RetryException
from synnefo.lib.db.transaction import commit_on_success_strict
@cmd_project_transaction_context(sync=True)
@commit_on_success_strict()
def join(proj_id, user_id, ctx=None):
join_project(proj_id, user_id)
@cmd_project_transaction_context(sync=True)
@commit_on_success_strict()
def leave(proj_id, user_id, ctx=None):
try:
leave_project(proj_id, user_id)
except PendingMembershipError as e:
print e
raise RetryException()
leave_project(proj_id, user_id)
@cmd_project_transaction_context()
@commit_on_success_strict()
def submit(name, user_id, prec, ctx=None):
try:
owner = AstakosUser.objects.get(id=user_id)
......@@ -73,6 +68,6 @@ def submit(name, user_id, prec, ctx=None):
app = submit_application(data, request_user=owner)
return app.id
@cmd_project_transaction_context(sync=True)
@commit_on_success_strict()
def approve(app_id, ctx=None):
approve_application(app_id)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment