Commit d850c441 authored by John E. Vincent's avatar John E. Vincent

some load test examples

parent 7a37ea46
......@@ -28,6 +28,11 @@ task :sample, :redis_url do |t, args|
Ohm::connect(:url => args.redis_url)
Ohm::redis.flushdb
puts "Creating watchers..."
Noah::Watcher.create :endpoint => "http://localhost:3000/webhook", :pattern => "//noah/application"
Noah::Watcher.create :endpoint => "http://localhost:3001/webhook", :pattern => "//noah/configuration"
Noah::Watcher.create :endpoint => "http://localhost:3002/webhook", :pattern => "//noah/host"
Noah::Watcher.create :endpoint => "http://localhost:3003/webhook", :pattern => "//noah/service"
puts "Creating Host entry for 'localhost'"
h = Noah::Host.create(:name => 'localhost', :status => "up")
if h.save
......
#!/usr/bin/env ruby
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
require 'rubygems'
require 'rbtrace'
require 'logger'
require 'optparse'
require 'em-hiredis'
......
require './simple-post.rb'
run NoahPostDemo
#!/usr/bin/env ruby
require 'sinatra'
require 'json'
post '/webhook' do
......
require 'sinatra/base'
require 'json'
class NoahPostDemo < Sinatra::Base
configure do
set :app_file, __FILE__
set :server, %w[thin]
set :logging, true
set :run, true
end
post '/webhook/?' do
x = request.body.read
p JSON.load(x)
end
end
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