Skip to content

Commit

Permalink
added 3 workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
praneeth-bala committed Dec 5, 2024
1 parent ea2efb8 commit d8873ad
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 1 deletion.
89 changes: 89 additions & 0 deletions scripts/browse_restaurant.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd" []>
<tsung loglevel="notice">
<clients>
<client host="localhost" use_controller_vm="true" />
</clients>
<servers>
<server host="rails-to-riches.eba-viwn7vp8.us-west-2.elasticbeanstalk.com" port="80" type="tcp" />
</servers>
<load>
<arrivalphase phase="1" duration="60" unit="second">
<users arrivalrate="2" unit="second"></users>
</arrivalphase>
<arrivalphase phase="2" duration="60" unit="second">
<users arrivalrate="4" unit="second"></users>
</arrivalphase>
<arrivalphase phase="3" duration="60" unit="second">
<users arrivalrate="8" unit="second"></users>
</arrivalphase>
<arrivalphase phase="4" duration="60" unit="second">
<users arrivalrate="16" unit="second"></users>
</arrivalphase>
<arrivalphase phase="5" duration="60" unit="second">
<users arrivalrate="32" unit="second"></users>
</arrivalphase>
<arrivalphase phase="6" duration="60" unit="second">
<users arrivalrate="64" unit="second"></users>
</arrivalphase>
<arrivalphase phase="7" duration="60" unit="second">
<users arrivalrate="128" unit="second"></users>
</arrivalphase>
</load>
<sessions>
<session name="browse_restaurants" probability="100" type="ts_http">
<!-- User Login -->
<request subst="true">
<dyn_variable name="jwt" re='\"jwt\":\"([^\"]+)\"' />
<http url="/api/login" method="POST" contents_from_file="./login.json">
<http_header name="Content-Type" value="application/json" />
</http>
</request>
<thinktime value="1" />

<!-- Loop over known restaurant IDs -->
<for var="restaurant_id" from="1" to="15" incr="1">

<!-- View Specific Restaurant Details -->
<request subst="true">
<http url="/api/restaurants/%%_restaurant_id%%" method="GET">
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>
<thinktime value="1" />

<!-- View Dishes for the Restaurant -->
<request subst="true">
<http url="/api/restaurants/%%_restaurant_id%%/dishes" method="GET">
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>

<!-- View Reviews for the Restaurant -->
<request subst="true">
<http url="/api/restaurants/%%_restaurant_id%%/reviews" method="GET">
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>

<!-- View Comments for a Specific Review -->
<for var="review_id" from="1" to="3" incr="1">
<request subst="true">
<http url="/api/restaurants/%%_restaurant_id%%/reviews/%%_review_id%%/comments" method="GET">
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>
</for>
<thinktime value="1" />

<!-- View Photos for the Restaurant -->
<request>
<http url="/api/restaurants/%%_restaurant_id%%/photos" method="GET">
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>
<thinktime value="1" />
</for>
</session>
</sessions>
</tsung>
6 changes: 6 additions & 0 deletions scripts/login.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"user": {
"email": "[email protected]",
"password": "password"
}
}
6 changes: 6 additions & 0 deletions scripts/review.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"review": {
"rating": 5,
"content": "This is a test review."
}
}
68 changes: 68 additions & 0 deletions scripts/review.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd" []>
<tsung loglevel="notice">
<clients>
<client host="localhost" use_controller_vm="true" />
</clients>
<servers>
<server host="rails-to-riches.eba-viwn7vp8.us-west-2.elasticbeanstalk.com" port="80" type="tcp" />
</servers>
<load>
<arrivalphase phase="1" duration="90" unit="second">
<users arrivalrate="1" unit="second"></users>
</arrivalphase>
<arrivalphase phase="2" duration="90" unit="second">
<users arrivalrate="3" unit="second"></users>
</arrivalphase>
<arrivalphase phase="3" duration="90" unit="second">
<users arrivalrate="6" unit="second"></users>
</arrivalphase>
<arrivalphase phase="4" duration="90" unit="second">
<users arrivalrate="12" unit="second"></users>
</arrivalphase>
<arrivalphase phase="5" duration="90" unit="second">
<users arrivalrate="24" unit="second"></users>
</arrivalphase>
</load>
<sessions>
<session name="add_reviews" probability="100" type="ts_http">
<!-- User Login -->
<request subst="true">
<dyn_variable name="jwt" re='\"jwt\":\"([^\"]+)\"' />
<http url="/api/login" method="POST" contents_from_file="./login.json">
<http_header name="Content-Type" value="application/json" />
</http>
</request>
<thinktime value="1" />

<!-- Loop over known restaurant IDs -->
<for var="restaurant_id" from="1" to="15" incr="1">

<!-- View Specific Restaurant Details -->
<request subst="true">
<http url="/api/restaurants/%%_restaurant_id%%" method="GET">
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>
<thinktime value="1" />

<!-- Submit a Review -->
<request subst="true">
<http url="/api/restaurants/%%_restaurant_id%%/reviews" method="POST" contents_from_file="./review.json">
<http_header name="Content-Type" value="application/json" />
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>
<thinktime value="1" />

<!-- Navigate Back to Dashboard (View All Restaurants) -->
<request>
<http url="/api/restaurants" method="GET">
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>
<thinktime value="1" />
</for>
</session>
</sessions>
</tsung>
2 changes: 1 addition & 1 deletion scripts/signupHome.xml → scripts/signup_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<!-- Access Dashboard -->
<request>
<http url="/api/restaurants" method="GET">
<http_header name="Authorization" value="Bearer ${jwt}" />
<http_header name="Authorization" value="Bearer %%_jwt%%" />
</http>
</request>
<thinktime value="1" />
Expand Down

0 comments on commit d8873ad

Please sign in to comment.