Skip to content

Instantly share code, notes, and snippets.

flood_report=$(curl --silent --user $FLOOD_API_TOKEN: https://api.flood.io/floods/$flood_uuid/report -r ".summary")
error_rate=$(curl --silent --user $FLOOD_API_TOKEN: https://api.flood.io/floods/$flood_uuid -r .error_rate)
response_time=$(curl --silent --user $FLOOD_API_TOKEN: https://api.flood.io/floods/$flood_uuid -r .response_time)
echo
echo "[$(date +%FT%T)+00:00] Detailed results at https://flood.io/$flood_uuid"
echo "---"
echo "$flood_report"
while [ $(curl --silent --user $FLOOD_API_TOKEN: https://api.flood.io/floods/$flood_uuid -r '.status == "finished"') = "false" ]; do
sleep 3
done
#!/bin/bash
set -e
echo "[$(date +%FT%T)+00:00] Launching flood"
flood_uuid=$(curl --silent -u $FLOOD_API_TOKEN: -X POST https://api.flood.io/floods \
-F "flood[privacy]=public" \
-F "flood_files[]=@$WORKSPACE/tests/ruby-jmeter.jmx" )
transaction '01_my_site_visit_home_page' do
visit '/' do
assert contains: 'Welcome to my site'
end
end
transaction '02_my_site_login' do
submit '/login', {
fill_in: {
'utf8' => '%E2%9C%93',
'authenticity_token' => '${authenticity_token}',
require 'ruby-jmeter'
test do
defaults domain: 'load-test.elasticoperations.com' # Our domain we are pointing to
cache clear_each_iteration: true # Keeps track of the simulated browser's cache and then clears the cache at the beginning of each iteration
cookies
# We define a load of 50 users that ramps up over 60 secords and a test that lasts for 120 seconds
threads 50, {ramp_time: 60, duration: 120, continue_forever: true} do
# Time of 1-3 seconds to space out user requests and simulate real life situation
random_timer 1000, 3000
# Extract csrf-token from the response body
<% Category.where(report_id: @report.id).each do |category| %>
<% if !@report.enabled_category_checks(category.name).empty? %>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title text-center"><%= category.name %></h3>
<div class="actions pull-right">
<i class="fa fa-chevron-down"></i>
</div>
<p><%= f.label :description %></p>
<p><%= f.text_area :description, :cols => 150, :rows => 5, class: "report_check_analysis" %></p>
<p><%= f.label :source %></p>
<p><%= f.text_area :source, :cols => 150, :rows => 5, class: "report_check_source" %></p>
<div class="dropdown">
<address class="checkout-address shipping-address" id="addy-select">
<div id="current-address">
<%= render 'layouts/shared/addy_select', shopping_address: current_order.ship_address %>
</div>
<div id="select-tag">
<%= render '/shopping/orders/select_tag', shopping_addresses: current_user.shipping_addresses %>
</div>
</address>
</div>
(0.1ms) BEGIN
SQL (0.2ms) INSERT INTO "cardvariants" ("card_id", "variant_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["card_id", 351], ["variant_id", 8], ["created_at", "2016-09-20 00:26:36.778965"], ["updated_at", "2016-09-20 00:26:36.778965"]]
(0.4ms) COMMIT
(0.1ms) BEGIN
SQL (0.2ms) INSERT INTO "cardvariants" ("card_id", "variant_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["card_id", 351], ["variant_id", 9], ["created_at", "2016-09-20 00:26:36.781620"], ["updated_at", "2016-09-20 00:26:36.781620"]]
(0.5ms) COMMIT
(0.1ms) BEGIN
SQL (0.3ms) INSERT INTO "cardvariants" ("card_id", "variant_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["card_id", 351], ["variant_id", 10], ["created_at", "2016-09-20 00:26:36.784496"], ["updated_at", "2016-09-20 00:26:36.784496"]]
(0.4ms) COMMIT
class CardsController < ApplicationController
def index
@sets = GameSet.all
@set = GameSet.find(params[:game_set_id])
@cards ||= params[:game_set_id].present? ? Card.where(game_set_id: params[:game_set_id]).page(params[:page]).per(9) : Card.all.page(params[:page]).per(9)
@order_item = current_order.order_items.new
@variant = Variant.all
puts params
end