Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Memcached Updates

 - Reduce capacity when provisioning instances on startup
 - Updated gems
 - Fixed unit tests, commented out tests expected to fail because sasl was disabled

Change-Id: I30005b6569dec99b5fb231723696328ab203af79
  • Loading branch information...
commit 6dfdbc0d5a3b2fda367288e0d9b3b96f16a534b9 1 parent 577f7e8
Harshawardhan Gadgil authored
View
6 memcached/Gemfile.lock
@@ -95,7 +95,7 @@ GEM
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
rspec-mocks (~> 2.10.0)
- rspec-core (2.10.0)
+ rspec-core (2.10.1)
rspec-expectations (2.10.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.10.1)
@@ -119,7 +119,7 @@ GEM
uuid (2.3.5)
macaddr (~> 1.0)
uuidtools (2.1.2)
- vcap_common (1.0.11)
+ vcap_common (1.0.12)
eventmachine (~> 0.12.11.cloudfoundry.3)
nats (~> 0.4.22.beta.8)
posix-spawn (~> 0.3.6)
@@ -127,7 +127,7 @@ GEM
yajl-ruby (~> 0.8.3)
vcap_logging (1.0.1)
rake
- vcap_services_base (0.1.9)
+ vcap_services_base (0.1.10)
curb (~> 0.7.16)
datamapper (~> 1.1.0)
do_sqlite3 (~> 0.10.3)
View
2  memcached/config/memcached_node.yml
@@ -16,6 +16,6 @@ port_range:
memcached_log_dir: /var/vcap/sys/log/memcached
max_clients: 500
memcached_timeout: 2
-sasl_enabled: true
+sasl_enabled: false
# z_interval: 30
View
2  memcached/lib/memcached_service/common.rb
@@ -6,7 +6,7 @@ module Services
module Memcached
module Common
def service_name
- "MaaS"
+ "MemcachedaaS"
end
end
end
View
1  memcached/lib/memcached_service/memcached_node.rb
@@ -251,6 +251,7 @@ def start_provisioned_instances
@logger.debug("Start provisioned instance....")
ProvisionedService.all.each do |instance|
+ @capacity -= capacity_unit
@logger.debug("instance : #{instance.inspect}")
@free_ports_mutex.synchronize do
@free_ports.delete(instance.port)
View
57 memcached/spec/node_spec.rb
@@ -41,8 +41,7 @@ class Node
:memcached_log_dir => "/tmp/memcached_log",
:command_rename_prefix => "protect-command",
:max_clients => 100,
- :memcached_memory => 16,
- :sasl_enabled => true
+ :memcached_memory => 16
}
FileUtils.mkdir_p(@options[:base_dir])
FileUtils.mkdir_p(@options[:memcached_log_dir])
@@ -178,17 +177,19 @@ class Node
memcached.get("test_key").should be_nil
end
- it "should not allow null credentials to access the instance" do
- hostname = get_hostname(@credentials)
- memcached = Dalli::Client.new(hostname)
- expect {memcached.get("test_key")}.should raise_error(RuntimeError)
- end
+# - These tests require sasl to be enabled, commenting them out for now if later on we decide
+# to enable sasl
+# it "should not allow null credentials to access the instance" do
+# hostname = get_hostname(@credentials)
+# memcached = Dalli::Client.new(hostname)
+# expect {memcached.get("test_key")}.should raise_error(RuntimeError)
+# end
- it "should not allow wrong credentials to access the instance" do
- hostname, username, password = get_connect_info(@credentials)
- memcached = Dalli::Client.new(hostname, username: username, password: 'wrong_password')
- expect {memcached.get("test_key")}.should raise_error(RuntimeError)
- end
+# it "should not allow wrong credentials to access the instance" do
+# hostname, username, password = get_connect_info(@credentials)
+# memcached = Dalli::Client.new(hostname, username: username, password: 'wrong_password')
+# expect {memcached.get("test_key")}.should raise_error(RuntimeError)
+# end
it "should delete the provisioned instance port in free port list when finish a provision" do
@node.free_ports.include?(@credentials["port"]).should == false
@@ -283,19 +284,21 @@ class Node
memcached.get("test_key").should be_nil
end
- it "should not allow null credentials to access the instance" do
- hostname = get_hostname(@binding_credentials)
- memcached = Dalli::Client.new(hostname)
- expect {memcached.get("test_key")}.should raise_error(RuntimeError)
- end
+# - These tests require sasl to be enabled, commenting them out for now if later on we decide
+# to enable sasl
+# it "should not allow null credentials to access the instance" do
+# hostname = get_hostname(@binding_credentials)
+# memcached = Dalli::Client.new(hostname)
+# expect {memcached.get("test_key")}.should raise_error(RuntimeError)
+# end
- it "should not allow wrong credentials to access the instance" do
- hostname = get_hostname(@binding_credentials)
- username = @binding_credentials['user']
- password = @binding_credentials['password']
- memcached = Dalli::Client.new(hostname, username: username, password: 'wrong_password')
- expect {memcached.get("test_key")}.should raise_error(RuntimeError)
- end
+# it "should not allow wrong credentials to access the instance" do
+# hostname = get_hostname(@binding_credentials)
+# username = @binding_credentials['user']
+# password = @binding_credentials['password']
+# memcached = Dalli::Client.new(hostname, username: username, password: 'wrong_password')
+# expect {memcached.get("test_key")}.should raise_error(RuntimeError)
+# end
it "should send binding message when finish a binding" do
@binding_credentials["hostname"].should be
@@ -338,7 +341,7 @@ class Node
memcached = []
# Create max_clients connections
hostname, username, password = get_connect_info(@credentials)
- for i in 1..(@options[:max_clients]-31)
+ for i in 1..(@options[:max_clients]-30)
memcached[i] = Dalli::Client.new(hostname, username: username, password: password)
memcached[i].set("foo", 1)
end
@@ -346,9 +349,9 @@ class Node
# The max_clients + 1 connection will raise exception
expect do
Dalli::Client.new(hostname, username: username, password: password).set("foo", 1)
- end.should raise_error(Dalli::DalliError)
+ end.should raise_error(Dalli::RingError)
# Close the max_clients connections
- for i in 1..(@options[:max_clients] - 31)
+ for i in 1..(@options[:max_clients] - 30)
memcached[i].close
end
# Now the new connection will be successful
View
BIN  memcached/vendor/cache/rspec-core-2.10.0.gem
Binary file not shown
View
BIN  memcached/vendor/cache/rspec-core-2.10.1.gem
Binary file not shown
View
BIN  memcached/vendor/cache/vcap_common-1.0.11.gem
Binary file not shown
View
BIN  memcached/vendor/cache/vcap_common-1.0.12.gem
Binary file not shown
View
BIN  memcached/vendor/cache/vcap_services_base-0.1.10.gem
Binary file not shown
View
BIN  memcached/vendor/cache/vcap_services_base-0.1.9.gem
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.