Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unix sockets issue. Fix tests. Merge with master. #283

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
/.idea/
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ node_js:
# Create a Travis memcached enabled environment for the test suite to run in and
# ensure that we test against localhost on Travis-CI.
services: memcache
env: MEMCACHED__HOST=localhost
#env:
# global:
# - MEMCACHED__HOST="localhost"
# - MEMCACHED__SOCKET_PATH=`pwd`/memcached.sock

# The `sevices: memcache` will start a memcached service on localhost
# and on the default port, but in order to test against multiple memcached
# instances we need to spawn a couple more, so we do that during the before
# script
before_script:
- memcached -p 11211 -d
- memcached -p 11212 -d
- memcached -p 11213 -d
- memcached -s memcached.sock -d

# Fix broken builds caused by packages using the carrot semver bullshit.
before_install:
Expand Down
4 changes: 2 additions & 2 deletions lib/memcached.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Client.config = {
// will receive the connection if the operation was successful
memcached.connect = function connect(server, callback) {
// Default port to 11211
if(!server.match(/(.+):(\d+)$/)) {
if(server[0] !== '/' && !server.match(/(.+):(\d+)$/)) {
server = server + ':11211';
}

Expand Down Expand Up @@ -545,7 +545,7 @@ Client.config = {
}

, 'VERSION': function version(tokens, dataSet) {
var versionTokens = /(\d+)(?:\.)(\d+)(?:\.)(\d+)$/.exec(tokens[1]);
var versionTokens = /^(\d+)(?:\.)(\d+)(?:\.)(\d+)/.exec(tokens[1]);

return [CONTINUE, {
server: this.serverAddress
Expand Down
5 changes: 4 additions & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
* @api public
*/
var testMemcachedHost = process.env.MEMCACHED__HOST || '10.211.55.5';
var testMemcachedSocketPath = process.env.MEMCACHED__SOCKET_PATH;

exports.servers = {
single: testMemcachedHost + ':11211'
single: testMemcachedHost + ':11211',
singleSocket: testMemcachedSocketPath
, multi: [
testMemcachedHost + ':11211'
, testMemcachedHost + ':11212'
, testMemcachedHost + ':11213'
, testMemcachedSocketPath
]
};

Expand Down
4 changes: 3 additions & 1 deletion test/memcached-add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
var assert = require('assert')
, fs = require('fs')
, common = require('./common')
, Memcached = require('../');
, Memcached = require('../')
, should = require('should')
;

global.testnumbers = global.testnumbers || +(Math.random(10) * 1000000).toFixed();

Expand Down
4 changes: 3 additions & 1 deletion test/memcached-cas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
*/
var assert = require('assert')
, common = require('./common')
, Memcached = require('../');
, Memcached = require('../')
, should = require('should')
;

global.testnumbers = global.testnumbers || +(Math.random(10) * 1000000).toFixed();

Expand Down
4 changes: 3 additions & 1 deletion test/memcached-connections.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
var assert = require('assert')
, fs = require('fs')
, common = require('./common')
, Memcached = require('../');
, Memcached = require('../')
, should = require('should')
;

global.testnumbers = global.testnumbers || +(Math.random(10) * 1000000).toFixed();

Expand Down
Loading