Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow the test kestrel's server ports to be set.

* Set nonstandard defaults
* Allow overrides with environment variables.

Closes #10
  • Loading branch information...
commit eadd9005005dddf728b155816cf7daf4042e30b6 1 parent 06c3dc6
@copiousfreetime authored
View
3  spec/client_spec.rb
@@ -1,10 +1,9 @@
require 'spec_helper'
-#$DEBUG = true
describe KJess::Client do
before do
@client_version = "2.4.1"
- @client = KJess::Client.new
+ @client = KJess::Spec.kjess_client()
end
after do
View
9 spec/kestrel_server.rb
@@ -47,7 +47,9 @@ def config_contents
new KestrelConfig {
listenAddress = "0.0.0.0"
- memcacheListenPort = 22133
+ memcacheListenPort = #{KJess::Spec.memcache_port}
+ textListenPort = #{KJess::Spec.text_port}
+ thriftListenPort = #{KJess::Spec.thrift_port}
queuePath = "#{KJess::Spec::KestrelServer.queue_path}"
@@ -62,7 +64,7 @@ def config_contents
default.maxMemorySize = 128.megabytes
default.maxJournalSize = 1.gigabyte
- admin.httpPort = 2223
+ admin.httpPort = #{KJess::Spec.admin_port}
admin.statsNodes = new StatsConfig {
reporters = new TimeSeriesCollectorConfig
@@ -100,6 +102,7 @@ def start
def is_running?
return "pong" == ping
rescue Exception => e
+ $stderr.puts e
false
end
@@ -129,9 +132,9 @@ def shutdown
h = get_response( 'shutdown' )
return h['response'] == "ok"
rescue => e
+ $stderr.puts e
false
end
end
-
end
end
View
2  spec/response/client_error_spec.rb
@@ -2,7 +2,7 @@
describe KJess::ClientError do
before do
- @client = KJess::Client.new
+ @client = KJess::Spec.kjess_client()
end
after do
View
20 spec/utils.rb
@@ -5,6 +5,26 @@ def self.project_root
File.expand_path( "..", ROOT )
end
+ def self.memcache_port
+ ENV['KJESS_MEMCACHE_PORT'] || 33122
+ end
+
+ def self.thrift_port
+ ENV['KJESS_THRIFT_PORT'] || 9992
+ end
+
+ def self.text_port
+ ENV['KJESS_TEXT_PORT'] || 9998
+ end
+
+ def self.admin_port
+ ENV['KJESS_ADMIN_PORT'] || 9999
+ end
+
+ def self.kjess_client
+ KJess::Client.new( :port => memcache_port )
+ end
+
def self.reset_server( client )
client.flush_all
qlist = client.stats['queues']
Please sign in to comment.
Something went wrong with that request. Please try again.